
# AutoAgents
**A production-grade multi-agent framework in Rust**
[](https://crates.io/crates/autoagents)
[](https://liquidos-ai.github.io/AutoAgents)
[](https://github.com/liquidos-ai/AutoAgents#license)
[](https://github.com/liquidos-ai/AutoAgents/actions)
[](https://codecov.io/gh/liquidos-ai/AutoAgents)
[](https://deepwiki.com/liquidos-ai/AutoAgents)


[English](README.md) | [中文](README.zh-CN.md) | [日本語](README.ja.md) | [Español](README.es.md) | [Français](README.fr.md) | [Deutsch](README.de.md) | [한국어](README.ko.md) | [Português (Brasil)](README.pt-BR.md)
Translations may lag behind the English README.
[Documentation](https://liquidos-ai.github.io/AutoAgents/) | [Examples](examples/) | [Contributing](CONTRIBUTING.md)
Like this project? Star us on GitHub
---
## Overview
AutoAgents is a modular, multi-agent framework for building intelligent systems in Rust. It combines a type-safe agent
model with structured tool calling, configurable memory, and pluggable LLM backends. The architecture is designed for performance, safety, and composability across server and edge, and serves as the foundation for a high-level agent harness.
---
## Key Features
- **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
- **LLM Guardrails**: Guardrail implementation for safeguarding LLM inference
- **LLM Optimization**: Build LLM pipelines with optimization passes like cache and retry for faster, more reliable inference
- **Multi-agent orchestration**: Typed pub/sub communication and environment management
- **Speech-Processing**: Local TTS and STT support
- **Observability**: OpenTelemetry tracing and metrics with pluggable exporters
---
## Supported LLM Providers
### Cloud Providers
| Provider | Feature | Chat | Streaming | Tool Calls | Structured Output | Vision / Multimodal |
| --- | --- | --- | --- | --- | --- | --- |
| **OpenAI** | `openai` | Yes | Yes | Yes | Yes | Image URLs and inline images; PDFs are rejected with a typed error. |
| **OpenRouter** | `openrouter` | Yes | Yes | Yes | Yes | OpenAI-compatible image inputs; PDFs are rejected with a typed error. |
| **Requesty** | `requesty` | Yes | Yes | Yes | Yes | OpenAI-compatible image inputs; PDFs are rejected with a typed error. |
| **Anthropic** | `anthropic` | Yes | Yes | Yes | Yes | Images, image URLs, and PDFs use Anthropic content blocks. |
| **DeepSeek** | `deepseek` | Yes | Yes | Yes | Yes | OpenAI-compatible image inputs; PDFs are rejected with a typed error. |
| **xAI** | `xai` | Yes | Yes | No | Model-dependent | Text-only chat; multimodal input returns `LLMError::InvalidRequest`. |
| **Phind** | `phind` | Yes | No* | No | No | Text-only chat; multimodal input returns `LLMError::InvalidRequest`. |
| **Groq** | `groq` | Yes | Yes | Yes | Yes | OpenAI-compatible image inputs; PDFs are rejected with a typed error. |
| **Google** | `google` | Yes | Yes | Yes | Yes | Inline images and PDFs; image URLs are rejected with a typed error. |
| **Azure OpenAI** | `azure_openai` | Yes | No* | Yes | Yes | Image URLs; PDFs and raw inline images are rejected with typed errors. |
| **MiniMax** | `minimax` | Yes | Yes | Yes | No | OpenAI-compatible image inputs; PDFs are rejected with a typed error. |
### Local Providers
| Provider | Crate / Feature | Chat | Streaming | Tool Calls | Structured Output | Vision / Multimodal | Local Inference |
| --- | --- | --- | --- | --- | --- | --- | --- |
| **Ollama** | `ollama` | Yes | Yes | Yes | Yes | Model-dependent | Yes, via Ollama server |
| **Mistral-rs** | `autoagents-mistral-rs` | Yes | Yes | Yes | Yes | Vision models supported | Yes, embedded runtime |
| **Llama-Cpp** | `autoagents-llamacpp` | Yes | Yes | Yes | Yes | Vision models supported with projector files | Yes, embedded runtime |
### Experimental Providers
See https://github.com/liquidos-ai/AutoAgents-Experimental-Backends
| Provider | Status |
| -------- | --------------- |
| **Burn** | ⚠️ Experimental |
| **Onnx** | ⚠️ Experimental |
Provider support is actively expanding based on community needs.
\* Providers marked **No** for streaming use the default `ChatProvider::chat_stream` implementation, which returns `LLMError::Generic("Streaming not supported for this provider")` rather than panicking.
---
## Installation
### Prerequisites
- **Rust** (latest stable recommended)
- **Cargo** package manager
- **LeftHook** for Git hooks management
- **Python 3.9+** (required for Python bindings)
- **uv** for Python environment and package management
- **maturin** (required to build/install local Python bindings from source)
### Prerequisite
```bash
sudo apt update
sudo apt install build-essential libasound2-dev alsa-utils pkg-config libssl-dev -y
```
### Install LeftHook
macOS (Homebrew):
```bash
brew install lefthook
```
Linux/Windows (npm):
```bash
npm install -g lefthook
```
### Clone and Build
```bash
git clone https://github.com/liquidos-ai/AutoAgents.git
cd AutoAgents
lefthook install
cargo build --workspace --features full
```
Hardware-specific accelerator features such as CUDA, Vulkan, and Metal require
the matching local toolchains and platforms. Enable those features only for the
specific backend you are building.
### Python Bindings
AutoAgents ships Python bindings to PyPI. Install the base package and add
backends via extras:
```bash
pip install autoagents-py # core + cloud LLM providers
pip install "autoagents-py[llamacpp]" # + llama.cpp CPU
pip install "autoagents-py[llamacpp-cuda]" # + llama.cpp CUDA
pip install "autoagents-py[llamacpp-metal]" # + llama.cpp Metal (macOS)
pip install "autoagents-py[llamacpp-vulkan]" # + llama.cpp Vulkan
pip install "autoagents-py[mistralrs]" # + mistral-rs CPU
pip install "autoagents-py[mistralrs-cuda]" # + mistral-rs CUDA
pip install "autoagents-py[mistralrs-metal]" # + mistral-rs Metal (macOS)
pip install "autoagents-py[guardrails]" # + Guardrails
pip install "autoagents-py[llamacpp-cuda,guardrails]" # combine extras
```
Development install from this repo:
```bash
uv venv --python=3.12
source .venv/bin/activate # Windows: .venv\Scripts\activate
uv pip install -U pip "maturin>=1.13.3,<2" pytest pytest-asyncio pytest-cov
# Clean, build, and install all CPU bindings into the active venv
make python-bindings-build
# Clean, build, and install CPU + CUDA bindings
make python-bindings-build-cuda
```
The Make targets remove stale editable-install extension artifacts before
rebuilding, which avoids loading out-of-date `.abi3.so` files from the source
tree.
Example scripts:
- Core cloud example: `bindings/python/autoagents/examples/openai_agent.py`
- llama.cpp example: `bindings/python/autoagents-llamacpp/examples/llamacpp_agent.py`
- mistral-rs example: `bindings/python/autoagents-mistralrs/examples/mistral_rs_agent.py`
### Run Tests
```bash
cargo test --features "full" --workspace
```
---
## Quick Start
```rust
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