基本的なサブエージェント
Astreusのドキュメントで基本的なサブエージェントについて学び、エージェントシステムを構築するためのセットアップの手引き、APIのパターン、実践的な例を確認しましょう。 信頼性の高いAstreusエージェントシステムを構築するために必要なセットアップのパターン、API、実践的な例を学びましょう。
複雑なタスク委任のために複数のAIエージェントを作成・連携させます。
クイックスタート
完全なサンプルをクローンする
最も簡単な始め方は、完全なサンプルリポジトリをクローンすることです。
git clone https://github.com/astreus-ai/examples
cd examples/sub-agents-basic
npm installまたはパッケージのみをインストール
ゼロから構築したい場合は次のようにします。
npm install @astreus-ai/astreus環境設定
# .env
OPENAI_API_KEY=sk-your-openai-api-key-here
DB_URL=sqlite://./astreus.dbシンプルなサブエージェントのセットアップ
import { Agent } from '@astreus-ai/astreus';
// Create specialized sub-agents
const researcher = await Agent.create({
name: 'Researcher',
model: 'gpt-4o',
systemPrompt: 'You are an expert researcher who gathers comprehensive information.'
});
const writer = await Agent.create({
name: 'Writer',
model: 'gpt-4o',
systemPrompt: 'You are a skilled writer who creates clear, engaging content.'
});
// Create main coordinator agent
const mainAgent = await Agent.create({
name: 'Coordinator',
model: 'gpt-4o',
systemPrompt: 'You coordinate tasks between specialized agents.',
subAgents: [researcher, writer]
});
// Use auto delegation
const result = await mainAgent.ask(
'Research artificial intelligence trends and write a summary',
{
useSubAgents: true,
delegation: 'auto'
}
);
console.log(result);サンプルの実行
リポジトリをクローンした場合は次を実行します。
npm run devゼロから構築した場合は、上記のコードを含むindex.tsファイルを作成し、次を実行します。
npx tsx index.tsリポジトリ
完全なサンプルはGitHubで公開されています: examples/sub-agents-basic
最終更新日: 2026年7月6日
このセクション内
最初のエージェント
Astreusのドキュメントで最初のエージェントについて学び、エージェントシステムを構築するためのセットアップの手引き、APIのパターン、実践的な例を確認しましょう。 信頼性の高いAstreusエージェントシステムを構築するために必要なセットアップのパターン、API、実践的な例を学びましょう。
メモリを使ったエージェント
Astreusのドキュメントでメモリを使ったエージェントについて学び、エージェントシステムを構築するためのセットアップの手引き、APIのパターン、実践的な例を確認しましょう。 信頼性の高いAstreusエージェントシステムを構築するために必要なセットアップのパターン、API、実践的な例を学びましょう。
ナレッジを使ったエージェント
Astreusのドキュメントでナレッジを使ったエージェントについて学び、エージェントシステムを構築するためのセットアップの手引き、APIのパターン、実践的な例を確認しましょう。 信頼性の高いAstreusエージェントシステムを構築するために必要なセットアップのパターン、API、実践的な例を学びましょう。
基本的なグラフ
Astreusのドキュメントで基本的なグラフについて学び、エージェントシステムを構築するためのセットアップの手引き、APIのパターン、実践的な例を確認しましょう。 信頼性の高いAstreusエージェントシステムを構築するために必要なセットアップのパターン、API、実践的な例を学びましょう。