liquidos-ai/AutoAgents
概要
複数のインテリジェントエージェントを構築、デプロイ、連携できる、Rust製のマルチエージェントフレームワーク
AI・機械学習できること
- Agent execution: ReAct and basic executors, streaming responses, and structured outputs
- Tooling: Derive macros for tools and outputs, plus a sandboxed WASM runtime for tool execution
- Memory: Sliding window memory with extensible backends
- LLM providers: Cloud and local backends behind a unified interface
計測したスター増加
- 24時間
- 0
- 7日間
- +8
- 15日間
- +13
- 1か月
- 履歴を収集中
期間ごとの純増数です。期間は重複しており、日別の値ではありません。未計測の値は空欄です。スター数は注目度の指標であり、品質の保証ではありません。
README.ja.md
オリジナル
AutoAgents
Rustによる本番運用向けマルチエージェントフレームワーク
English | 中文 | 日本語 | Español | Français | Deutsch | 한국어 | Português (Brasil)
この翻訳はコミュニティにより保守され、英語版より遅れる可能性があります。差異がある場合は英語版が正です。
このプロジェクトが気に入りましたか? GitHubでスターを付けてください
概要
AutoAgents は、Rust で知的システムを構築するためのモジュール型マルチエージェントフレームワークです。型安全なエージェントモデル、構造化されたツール呼び出し、構成可能なメモリ、差し替え可能な LLM バックエンドを統合しています。アーキテクチャは性能・安全性・合成可能性を重視し、サーバーとエッジの両方を対象に設計されており、高レベルなエージェントハーネスの基盤にもなります。
主な機能
- エージェント実行:ReAct と基本エグゼキュータ、ストリーミング応答、構造化出力
- ツール:ツールと出力の派生マクロ、ツール実行のためのサンドボックス化 WASM ランタイム
- メモリ:スライディングウィンドウメモリと拡張可能なバックエンド
- LLM プロバイダー:統一インターフェースによるクラウドとローカルのバックエンド
- LLM 最適化:キャッシュやリトライなどの最適化パスを備えた LLM パイプラインを構築し、推論の速度と信頼性を向上
- マルチエージェント編成:型付き pub/sub 通信と環境管理
- 音声処理:ローカル TTS と STT サポート
- 可観測性:OpenTelemetry のトレースとメトリクス、プラガブルなエクスポーター
対応 LLM プロバイダー
クラウドプロバイダー
| プロバイダー | Feature | チャット | ストリーミング | ツール呼び出し | 構造化出力 | ビジョン / マルチモーダル |
|---|---|---|---|---|---|---|
| OpenAI | openai |
対応 | 対応 | 対応 | 対応 | 画像 URL とインライン画像;PDF は型付きエラーで拒否。 |
| OpenRouter | openrouter |
対応 | 対応 | 対応 | 対応 | OpenAI 互換の画像入力;PDF は型付きエラーで拒否。 |
| Requesty | requesty |
対応 | 対応 | 対応 | 対応 | OpenAI 互換の画像入力;PDF は型付きエラーで拒否。 |
| Anthropic | anthropic |
対応 | 対応 | 対応 | 対応 | 画像、画像 URL、PDF は Anthropic のコンテンツブロックを使用。 |
| DeepSeek | deepseek |
対応 | 対応 | 対応 | 対応 | OpenAI 互換の画像入力;PDF は型付きエラーで拒否。 |
| xAI | xai |
対応 | 対応 | 非対応 | モデル依存 | テキストのみのチャット;マルチモーダル入力は LLMError::InvalidRequest を返す。 |
| Phind | phind |
対応 | 非対応* | 非対応 | 非対応 | テキストのみのチャット;マルチモーダル入力は LLMError::InvalidRequest を返す。 |
| Groq | groq |
対応 | 対応 | 対応 | 対応 | OpenAI 互換の画像入力;PDF は型付きエラーで拒否。 |
google |
対応 | 対応 | 対応 | 対応 | インライン画像と PDF;画像 URL は型付きエラーで拒否。 | |
| Azure OpenAI | azure_openai |
対応 | 非対応* | 対応 | 対応 | 画像 URL;PDF と生のインライン画像は型付きエラーで拒否。 |
| MiniMax | minimax |
対応 | 対応 | 対応 | 非対応 | OpenAI 互換の画像入力;PDF は型付きエラーで拒否。 |
ローカルプロバイダー
| プロバイダー | Crate / Feature | チャット | ストリーミング | ツール呼び出し | 構造化出力 | ビジョン / マルチモーダル | ローカル推論 |
|---|---|---|---|---|---|---|---|
| Ollama | ollama |
対応 | 対応 | 対応 | 対応 | モデル依存 | Ollama サーバー経由 |
| Mistral-rs | autoagents-mistral-rs |
対応 | 対応 | 対応 | 対応 | ビジョンモデル対応 | 組み込みランタイム |
| Llama-Cpp | autoagents-llamacpp |
対応 | 対応 | 対応 | 対応 | projector ファイルでビジョンモデル対応 | 組み込みランタイム |
実験的プロバイダー
詳細: https://github.com/liquidos-ai/AutoAgents-Experimental-Backends
| プロバイダー | 状態 |
|---|---|
| Burn | ⚠️ 実験的 |
| Onnx | ⚠️ 実験的 |
プロバイダーの対応はコミュニティの要望に応じて拡張中です。
* ストリーミングが 非対応 と記載されたプロバイダーは、デフォルトの ChatProvider::chat_stream 実装を使用し、panic する代わりに LLMError::Generic("Streaming not supported for this provider") を返します。
インストール
前提条件
- Rust(最新安定版推奨)
- Cargo パッケージマネージャ
- LeftHook(Git hooks 管理)
Prerequisite
sudo apt update
sudo apt install build-essential libasound2-dev alsa-utils pkg-config libssl-dev -y
LeftHook のインストール
macOS(Homebrew):
brew install lefthook
Linux/Windows(npm):
npm install -g lefthook
クローンとビルド
git clone https://github.com/liquidos-ai/AutoAgents.git
cd AutoAgents
lefthook install
cargo build --workspace --features full
CUDA、Vulkan、Metal などのハードウェア固有のアクセラレータ機能には、 対応するローカルのツールチェーンとプラットフォームが必要です。これらの機能は、 ビルドする特定のバックエンドに対してのみ有効にしてください。
Python バインディング
AutoAgents は Python バインディングを個別パッケージとして提供します:
autoagents-py(コア Python API + クラウドバックエンド)autoagents-guardrails-py(PythonLLMProvider向けのオプション Guardrails)autoagents-llamacpp-py(任意のローカル llama.cpp バックエンド)autoagents-mistral-rs-py(任意のローカル mistral-rs バックエンド)
このリポジトリからの開発用インストール:
uv venv --python=3.12
source .venv/bin/activate # Windows: .venv\Scripts\activate
uv pip install -U pip maturin==1.13.3 pytest pytest-asyncio pytest-cov
# CPU バインディングをクリーン、ビルド、インストール
make python-bindings-build
# CPU + CUDA バインディングをクリーン、ビルド、インストール
make python-bindings-build-cuda
Make ターゲットは再ビルド前に古い editable-install アーティファクトを削除するため、
ソースツリー内の古い .abi3.so が読み込まれるのを防げます。
サンプルスクリプト:
- コアクラウド例:
bindings/python/autoagents/examples/openai_agent.py - llama.cpp 例:
bindings/python/autoagents-llamacpp/examples/llamacpp_agent.py - mistral-rs 例:
bindings/python/autoagents-mistralrs/examples/mistral_rs_agent.py
テストの実行
cargo test --features "full" --workspace
クイックスタート
use autoagents::core::agent::memory::SlidingWindowMemory;
use autoagents::core::agent::prebuilt::executor::{ReActAgent, ReActAgentOutput};
use autoagents::core::agent::task::Task;
use autoagents::core::agent::{AgentBuilder, AgentDeriveT, AgentOutputT, DirectAgent};
use autoagents::core::error::Error;
use autoagents::core::tool::{ToolCallError, ToolInputT, ToolRuntime, ToolT};
use autoagents::llm::LLMProvider;
use autoagents::llm::backends::openai::OpenAI;
use autoagents::llm::builder::LLMBuilder;
use autoagents_derive::{agent, tool, AgentHooks, AgentOutput, ToolInput};
use serde::{Deserialize, Serialize};
use serde_json::Value;
use std::sync::Arc;
#[derive(Serialize, Deserialize, ToolInput, Debug)]
pub struct AdditionArgs {
#[input(description = "Left Operand for addition")]
left: i64,
#[input(description = "Right Operand for addition")]
right: i64,
}
#[tool(
name = "Addition",
description = "Use this tool to Add two numbers",
input = AdditionArgs,
)]
struct Addition {}
#[async_trait]
impl ToolRuntime for Addition {
async fn execute(&self, args: Value) -> Result<Value, ToolCallError> {
println!("execute tool: {:?}", args);
let typed_args: AdditionArgs = serde_json::from_value(args)?;
let result = typed_args.left + typed_args.right;
Ok(result.into())
}
}
#[derive(Debug, Serialize, Deserialize, AgentOutput)]
pub struct MathAgentOutput {
#[output(description = "The addition result")]
value: i64,
#[output(description = "Explanation of the logic")]
explanation: String,
#[output(description = "If user asks other than math questions, use this to answer them.")]
generic: Option<String>,
}
#[agent(
name = "math_agent",
description = "You are a Math agent",
tools = [Addition],
output = MathAgentOutput,
)]
#[derive(Default, Clone, AgentHooks)]
pub struct MathAgent {}
impl From<ReActAgentOutput> for MathAgentOutput {
fn from(output: ReActAgentOutput) -> Self {
let resp = output.response;
if output.done && !resp.trim().is_empty() {
if let Ok(value) = serde_json::from_str::<MathAgentOutput>(&resp) {
return value;
}
}
MathAgentOutput {
value: 0,
explanation: resp,
generic: None,
}
}
}
pub async fn simple_agent(llm: Arc<dyn LLMProvider>) -> Result<(), Error> {
let sliding_window_memory = Box::new(SlidingWindowMemory::new(10));
let agent_handle = AgentBuilder::<_, DirectAgent>::new(ReActAgent::new(MathAgent {}))
.llm(llm)
.memory(sliding_window_memory)
.build()
.await?;
let result = agent_handle.agent.run(Task::new("What is 1 + 1?")).await?;
println!("Result: {:?}", result);
Ok(())
}
#[tokio::main]
async fn main() -> Result<(), Error> {
let api_key = std::env::var("OPENAI_API_KEY").unwrap_or("".into());
let llm: Arc<OpenAI> = LLMBuilder::<OpenAI>::new()
.api_key(api_key)
.model("gpt-4o")
.max_tokens(512)
.temperature(0.2)
.build()
.expect("Failed to build LLM");
let _ = simple_agent(llm).await?;
Ok(())
}
AutoAgents CLI
AutoAgents CLI は YAML 設定からエージェントワークフローを実行し、HTTP で提供します。詳細は https://github.com/liquidos-ai/AutoAgents-CLI を参照してください。
例
すぐに始めるための例:
基本
ツール付きのシンプルなエージェント、非常に基本的なエージェント、エッジエージェント、チェーン、Actor ベースモデル、ストリーミング、Agent Hooks の追加などを示します。
LLM パイプライン
キャッシュやリトライなどの最適化パスを備えた LLM パイプラインを示し、性能と信頼性の向上を実演します。
ガードレール
パイプラインの LLMLayer を使い、Block・Sanitize・Audit ポリシーで入力/出力ガードレールを設定する方法を示します。
MCP 連携
AutoAgents を Model Context Protocol (MCP) と統合する方法を示します。
ローカルモデル
ローカルモデル向けに Mistral-rs と AutoAgents を統合する方法を示します。
デザインパターン
チェーン、プランニング、ルーティング、並列、リフレクションの各パターンを示します。
プロバイダー
さまざまな LLM プロバイダーの利用例です。
WASM ツール実行
WASM ランタイムでツールを実行できるシンプルなエージェントです。
コーディングエージェント
ファイル操作機能を備えた ReAct ベースの高度なコーディングエージェントです。
音声
リアルタイムの TTS と STT を用いた AutoAgents 音声例です。
Android ローカルエージェント
AutoAgents-llamacpp バックエンドを使って Android 上でローカルモデルを動かす例です。
コンポーネント
AutoAgents はモジュール化アーキテクチャで構築されています:
AutoAgents/
├── crates/
│ ├── autoagents/ # Main library entry point
│ ├── autoagents-core/ # Core agent framework
│ ├── autoagents-protocol/ # Shared protocol/event types
│ ├── autoagents-llm/ # LLM provider implementations
│ ├── autoagents-telemetry/ # OpenTelemetry integration
│ ├── autoagents-toolkit/ # Collection of ready-to-use tools
│ ├── autoagents-mistral-rs/ # LLM provider implementations using Mistral-rs
│ ├── autoagents-llamacpp/ # LLM provider implementation using LlamaCpp
│ ├── autoagents-speech/ # Speech model support for TTS and STT
│ ├── autoagents-guardrails/ # LLM Guardrails implementation
│ ├── autoagents-qdrant/ # Qdrant vector store
│ └── autoagents-derive/ # Procedural macros
├── examples/ # Example implementations
├── bindings/ # Bindings for different languages
コアコンポーネント
- エージェント:知能の基本単位
- 環境:エージェントのライフサイクルと通信を管理
- メモリ:構成可能なメモリシステム
- ツール:外部機能の統合
- エグゼキュータ:推論パターン(ReAct、Chain-of-Thought)
開発
テストの実行
cargo test --features default
# Python バインディング
make python-bindings-test-clean
# Coverage (requires cargo-tarpaulin)
cargo install cargo-tarpaulin
rustup component add llvm-tools-preview
make coverage-rust
ベンチマークの実行
cargo bench -p autoagents-core --bench agent_runtime
Git Hooks
本プロジェクトは LeftHook による Git hooks 管理を利用しています。フックは自動的に次を実行します:
cargo fmt --checkでコードを整形cargo clippy -- -D warningsで静的解析- Rust テストは
cargo test --features fullで実行 - Python バインディングのテストは
make python-bindings-testで実行
コントリビュート
コントリビュートを歓迎します。詳細は コントリビュートガイド と 行動規範 をご覧ください。
ドキュメント
- API ドキュメント:フレームワークの完全なドキュメント
- FAQ:よくある質問とトラブルシューティング
- 例:実用的な実装例
コミュニティ
- GitHub Issues:バグ報告と機能要望
- Discussions:コミュニティ Q&A とアイデア
- Discord:Discord コミュニティに参加 https://discord.gg/zfAF9MkEtK
パフォーマンス
AutoAgents は高性能を目指して設計されています:
- メモリ効率:構成可能なバックエンドによる最適化
- 並行性:tokio による async/await 完全対応
- スケーラブル:マルチエージェント協調による水平スケール
- 型安全:Rust の型システムによるコンパイル時保証
FAQ
インストール、プロバイダー、エグゼキューター、環境ライフサイクル、トラブルシューティングについては、ドキュメントの FAQ を参照してください。
ライセンス
AutoAgents はデュアルライセンスです:
- MIT License(MIT_LICENSE)
- Apache License 2.0(APACHE_LICENSE)
利用用途に合わせていずれかを選択できます。
謝辞
Liquidos AI チームと、素晴らしい研究者・エンジニアコミュニティによって構築されています。
特別な感謝:
- 素晴らしいエコシステムを提供する Rust コミュニティ
- 高品質なモデル API を提供する LLM プロバイダー
- AutoAgents を改善してくれる全ての貢献者
スター履歴
関連プロジェクトを探す
読み込み中…