Astreus

ナレッジを使ったエージェント

Astreusのドキュメントでナレッジを使ったエージェントについて学び、エージェントシステムを構築するためのセットアップの手引き、APIのパターン、実践的な例を確認しましょう。 信頼性の高いAstreusエージェントシステムを構築するために必要なセットアップのパターン、API、実践的な例を学びましょう。

情報検索を強化するナレッジベース機能を備えたエージェントを作成します。

クイックスタート

完全なサンプルをクローンする

最も簡単な始め方は、完全なサンプルリポジトリをクローンすることです。

git clone https://github.com/astreus-ai/examples
cd examples/agent-with-knowledge
npm install

またはパッケージのみをインストール

ゼロから構築したい場合は次のようにします。

npm install @astreus-ai/astreus

環境設定

# .env
# LLM API key
OPENAI_API_KEY=sk-your-openai-api-key-here

# Knowledge database (required for RAG)
KNOWLEDGE_DB_URL=postgresql://username:password@localhost:5432/knowledge_db

# Main database for agent persistence
DB_URL=sqlite://./astreus.db

ナレッジエージェント

import { Agent } from '@astreus-ai/astreus';

// Create agent with knowledge enabled
const agent = await Agent.create({
  name: 'CosmosBot',
  model: 'gpt-4o',
  embeddingModel: 'text-embedding-3-small', // Specify embedding model directly
  knowledge: true,
  systemPrompt: 'You can search and retrieve information from scientific knowledge bases about the cosmos and universe.'
});

// Add knowledge from scientific book about the sun and cosmos
await agent.addKnowledgeFromFile(
  './data/The Sun\'s Light and Heat.pdf',
  { category: 'solar-physics', version: '1.0' }
);

// Agent automatically uses knowledge in conversations
const response = await agent.ask("What is Correction for Atmospheric Absorption? Explain.");
console.log(response); // Uses knowledge base automatically

サンプルの実行

リポジトリをクローンした場合は次を実行します。

npm run dev

リポジトリ

完全なサンプルはGitHubで公開されています: examples/agent-with-knowledge

最終更新日: 2026年7月6日

このセクション内

最初のエージェント

Astreusのドキュメントで最初のエージェントについて学び、エージェントシステムを構築するためのセットアップの手引き、APIのパターン、実践的な例を確認しましょう。 信頼性の高いAstreusエージェントシステムを構築するために必要なセットアップのパターン、API、実践的な例を学びましょう。

基本的なサブエージェント

Astreusのドキュメントで基本的なサブエージェントについて学び、エージェントシステムを構築するためのセットアップの手引き、APIのパターン、実践的な例を確認しましょう。 信頼性の高いAstreusエージェントシステムを構築するために必要なセットアップのパターン、API、実践的な例を学びましょう。

高度なサブエージェント

複雑な連携パターンと専門的な機能を備えた、洗練されたマルチエージェントワークフローを構築します。 信頼性の高いAstreusエージェントシステムを構築するために必要なセットアップのパターン、API、実践的な例を学びましょう。

基本的なグラフ

Astreusのドキュメントで基本的なグラフについて学び、エージェントシステムを構築するためのセットアップの手引き、APIのパターン、実践的な例を確認しましょう。 信頼性の高いAstreusエージェントシステムを構築するために必要なセットアップのパターン、API、実践的な例を学びましょう。