機能
Astreusのドキュメントで機能について学び、エージェントシステムを構築するためのセットアップの手引き、APIのパターン、実践的な例を確認しましょう。 信頼性の高いAstreusエージェントシステムを構築するために必要なセットアップのパターン、API、実践的な例を学びましょう。
新しいエージェントをスキャフォールドする際に含められる各機能の詳細な説明です。
Memory(メモリ)
エージェントの永続的なメモリを有効にします。エージェントはベクトル検索を使って効率的に情報を取得し、セッションをまたいで会話を記憶します。
const agent = await Agent.create({
name: 'my-agent',
model: 'gpt-4o',
memory: true,
});
await agent.ask("My name is John");
// Later, even in a new session:
await agent.ask("What's my name?"); // "Your name is John"ユースケース:
- ユーザーの好みを記憶するパーソナルアシスタント
- 会話履歴を持つカスタマーサポートボット
- コンテキストの永続化が必要な長時間稼働のエージェント
Knowledge(RAG)
ドキュメント検索機能を追加します。PDF やテキストファイルなどのドキュメントを検索可能なナレッジベースに取り込みます。
const agent = await Agent.create({
name: 'my-agent',
model: 'gpt-4o',
knowledge: true,
});
// Add documents to knowledge base
await agent.addKnowledgeFromFile('./docs/guide.pdf', { category: 'docs' });
await agent.addKnowledgeFromFile('./docs/api.md', { category: 'api' });
// Agent answers from documents
await agent.ask("What does the guide say about authentication?");ユースケース:
- ドキュメント Q&A ボット
- リサーチアシスタント
- ナレッジ管理システム
要件: pgvector 拡張機能を備えた PostgreSQL
Graph Workflows(グラフワークフロー)
DAG ベースのタスクオーケストレーションによって、複雑な複数ステップのワークフローを作成します。タスク間の依存関係を定義し、可能な限り並列に実行できます。
import { Agent, Graph } from '@astreus-ai/astreus';
const agent = await Agent.create({ name: 'my-agent', model: 'gpt-4o' });
const graph = new Graph({ name: 'research-workflow' }, agent);
// Define workflow nodes
const researchNode = graph.addTaskNode({
prompt: 'Research the topic thoroughly'
});
const analyzeNode = graph.addTaskNode({
prompt: 'Analyze the research findings',
dependsOn: [researchNode]
});
const writeNode = graph.addTaskNode({
prompt: 'Write a comprehensive report',
dependsOn: [analyzeNode]
});
// Execute the workflow
const result = await graph.run();
console.log(result.results);ユースケース:
- 複数ステップのコンテンツ生成
- データ処理パイプライン
- 複雑な意思決定ワークフロー
Sub-Agents(サブエージェント)
複雑なタスクのために複数の専門エージェントを連携させます。各サブエージェントは独自の設定と専門性を持てます。
// Create specialized agents
const researcher = await Agent.create({
name: 'researcher',
model: 'gpt-4o',
systemPrompt: 'You are a research specialist.'
});
const writer = await Agent.create({
name: 'writer',
model: 'gpt-4o',
systemPrompt: 'You are a professional writer.'
});
// Main agent coordinates sub-agents
const agent = await Agent.create({ name: 'coordinator', model: 'gpt-4o' });
const result = await agent.executeWithSubAgents(
'Research and write an article about quantum computing',
[researcher, writer]
);ユースケース:
- コンテンツ制作パイプライン
- 複数分野にまたがるエキスパートシステム
- 並列タスク実行
Custom Plugins(カスタムプラグイン)
カスタムツールでエージェントを拡張します。各ツールに対してパラメータ、説明、ハンドラーを定義します。
const weatherPlugin = {
name: 'weather-plugin',
version: '1.0.0',
description: 'Get weather information',
tools: [{
name: 'get_weather',
description: 'Get current weather for a location',
parameters: {
location: {
type: 'string',
description: 'City name',
required: true
}
},
handler: async ({ location }) => {
const response = await fetch(`https://api.weather.com/${location}`);
const data = await response.json();
return { success: true, data };
}
}]
};
const agent = await Agent.create({ name: 'my-agent', model: 'gpt-4o' });
await agent.registerPlugin(weatherPlugin);
// Agent can now use the weather tool
await agent.ask("What's the weather in Tokyo?");ユースケース:
- API 連携
- データベース操作
- カスタムビジネスロジック
MCP Integration(MCP 連携)
標準化されたツール連携のための Model Context Protocol サポートです。MCP 互換のサービスやツールに接続できます。
const agent = await Agent.create({
name: 'my-agent',
model: 'gpt-4o',
mcp: {
servers: [
{ name: 'filesystem', command: 'mcp-server-filesystem' },
{ name: 'github', command: 'mcp-server-github' }
]
}
});ユースケース:
- ファイルシステム操作
- GitHub 連携
- 標準化されたツールエコシステム
機能の組み合わせ
各機能はシームレスに連携します。
const agent = await Agent.create({
name: 'advanced-agent',
model: 'gpt-4o',
memory: true, // Remember conversations
knowledge: true, // Access documents
mcp: { // Use MCP tools
servers: [
{ name: 'filesystem', command: 'mcp-server-filesystem' }
]
}
});
// Register custom plugins
await agent.registerPlugin(myCustomPlugin);
// Use with graph workflows
const graph = new Graph({ name: 'workflow' }, agent);最終更新日: 2026年7月6日
このセクション内