Astreus

クイックスタート

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

5分以内に最初の Astreus エージェントプロジェクトを作成しましょう。

インストール方法

npx を使う(推奨)

npx create-astreus-agent my-agent

npm create を使う

npm create astreus-agent my-agent

pnpm を使う

pnpm create astreus-agent my-agent

対話形式のセットアップ

1. プロジェクト名

? What is your project name? my-agent

プロジェクト名を入力します。新しいディレクトリが作成されます。使用できるのは英字、数字、ハイフン、アンダースコアのみです。

2. 機能の選択

? Which features do you want to include?
  ◉ Memory - Persistent agent memory with vector search
  ◉ Knowledge (RAG) - Document ingestion and retrieval
  ◯ Graph Workflows - DAG-based task orchestration
  ◯ Sub-Agents - Multi-agent coordination
  ◯ Custom Plugins - Extensible tool system
  ◯ MCP Integration - Model Context Protocol support

矢印キーとスペースキーで機能を選択します。すべての機能は任意です。

3. LLM プロバイダー

? Which LLM provider do you want to use?
  ● OpenAI - GPT-4, GPT-3.5
  ○ Anthropic - Claude
  ○ Google - Gemini
  ○ Ollama - Local models
  ○ Multiple providers - Configure later

お好みのプロバイダーを選ぶか、後で設定する場合は「Multiple providers」を選択してください。

4. TypeScript

? Use TypeScript? Yes

より良い開発体験のために TypeScript の使用をお勧めします。

インストール後の作業

プロジェクトが作成されたら、以下を実行します。

# プロジェクトディレクトリへ移動
cd my-agent

# 依存関係をインストール
npm install

# 環境変数テンプレートをコピー
cp .env.example .env

# .env を編集して API キーを設定
nano .env  # またはお好みのエディタを使用

# エージェントを起動
npm run dev

例: 最初の会話

起動が完了すると、エージェントはすぐに使える状態になります。

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

const agent = await Agent.create({
  name: 'my-agent',
  model: 'gpt-4o',
  memory: true,
});

// 会話する
const response = await agent.ask("Hello! What can you help me with?");
console.log(response);

生成されるコード

CLI は完全な src/index.ts を生成します。

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

async function main() {
  console.log('Starting Astreus Agent...\n');

  const agent = await Agent.create({
    name: 'my-agent',
    model: 'gpt-4o',
    systemPrompt: 'You are a helpful AI assistant powered by Astreus.',
    memory: true,
  });

  // Interactive loop
  const readline = await import('readline');
  const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout,
  });

  console.log('Agent ready! Type your message (or "exit" to quit):\n');

  const prompt = () => {
    rl.question('You: ', async (input) => {
      if (input.toLowerCase() === 'exit') {
        console.log('\nGoodbye!');
        rl.close();
        process.exit(0);
      }

      try {
        const response = await agent.ask(input);
        console.log(`\nAgent: ${response}\n`);
      } catch (error) {
        console.error('Error:', error instanceof Error ? error.message : error);
      }

      prompt();
    });
  };

  prompt();
}

main().catch(console.error);

必要要件

  • Node.js >= 22.0.0
  • npm、yarn、または pnpm
  • LLM プロバイダーの API キー(ローカルモデルの場合は Ollama)

次のステップ

  • 機能 - 各機能について学ぶ
  • 設定 - 環境設定

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