acton-ai
Build production-ready AI agents in Rust with minimal boilerplate.
Acton-ai handles the hard problems—concurrency, fault tolerance, rate limiting, streaming, and tool execution—so you can focus on your application logic.
At a Glance
use *;
async
Five lines to an interactive chat with file access and command execution.
Features
- Multi-provider support — Anthropic Claude, OpenAI, Ollama, and any OpenAI-compatible API
- Streaming responses — Token-by-token callbacks for real-time output
- Built-in tools — File operations, bash, grep, glob, web fetch, and calculations
- Tool execution loop — Automatic tool calling and result handling until completion
- Two API levels — Simple facade for common cases, full actor access for advanced control
- TOML configuration — Define providers and settings in config files
- Hyperlight sandboxing — Hardware-isolated execution for untrusted code (KVM/Hyper-V)
- Rate limiting — Built-in request and token limits per provider
- Actor-based architecture — Fault-tolerant, concurrent design via acton-reactive
Installation
For Ollama (local), no API key is needed. For cloud providers, set environment variables:
Quick Start
Common patterns to get you started. Complete examples in examples/.
Simple Prompt
use *;
async
Streaming Output
runtime
.prompt
.on_token
.collect
.await?;
Multi-turn Conversation
let mut conv = runtime.conversation
.system
.build;
let response = conv.send.await?;
println!;
// Context is maintained
let response = conv.send.await?;
println!;
Using Built-in Tools
let runtime = builder
.app_name
.ollama
.with_builtins // Enable all built-in tools
.launch
.await?;
runtime
.prompt
.on_token
.collect
.await?;
Custom Tools
runtime
.prompt
.tool
.collect
.await?;
Multiple Providers
let runtime = builder
.app_name
.provider_named
.provider_named
.default_provider
.launch
.await?;
// Quick tasks on local
runtime.prompt.collect.await?;
// Complex reasoning on cloud
runtime.prompt.provider.collect.await?;
Configuration
Configure providers via TOML files or programmatically.
Config File
Create acton-ai.toml in your project root or ~/.config/acton-ai/config.toml:
= "ollama"
[]
= "ollama"
= "qwen2.5:7b"
= "http://localhost:11434/v1"
= 300
[]
= 1000
= 1000000
[]
= "anthropic"
= "claude-sonnet-4-20250514"
= "ANTHROPIC_API_KEY"
# Optional: Hyperlight sandbox for tool isolation
[]
= 4
= 32
[]
= 30000
= 64
Load the configuration:
let runtime = builder
.app_name
.from_config?
.with_builtins
.launch
.await?;
Programmatic Configuration
let runtime = builder
.app_name
.provider_named
.provider_named
.default_provider
.with_builtins
.with_sandbox_pool // Pre-warm 4 Hyperlight sandboxes
.launch
.await?;
Built-in Tools
Available when you call .with_builtins():
| Tool | Description |
|---|---|
read_file |
Read file contents with line numbers |
write_file |
Write content to files |
edit_file |
Make targeted string replacements |
list_directory |
List directory contents with metadata |
glob |
Find files matching glob patterns |
grep |
Search file contents with regex |
bash |
Execute shell commands |
calculate |
Evaluate mathematical expressions |
web_fetch |
Fetch content from URLs |
Select specific tools with .with_builtin_tools(&["read_file", "glob", "bash"]).
Architecture
Acton-ai uses the actor model for fault-tolerant, concurrent AI systems:
ActonAI (Facade)
│
├── ActorRuntime (acton-reactive)
│ │
│ ├── Kernel ─────────── Central supervisor, agent lifecycle
│ │
│ ├── LLMProvider(s) ─── API calls, streaming, rate limiting
│ │
│ ├── Agent(s) ───────── Individual AI agents with reasoning
│ │
│ └── ToolRegistry ───── Tool registration and execution
│
└── BuiltinTools ──────────── File ops, bash, web fetch, etc.
Two API levels:
| Level | Use Case | Access |
|---|---|---|
| High-level | Most applications | ActonAI::builder(), PromptBuilder, Conversation |
| Low-level | Custom agent topologies | Direct actor spawning, message routing, subscriptions |
The high-level API handles actor lifecycle, subscriptions, and message routing automatically. Drop down to the low-level API when you need custom supervision strategies or multi-agent coordination.
Examples
# Interactive chat with tools
# Multiple LLM providers
# Custom tool definitions
# Hyperlight sandboxed execution
# Per-agent tool configuration
Documentation
- API Documentation (docs.rs)
- acton-reactive — The underlying actor framework
Contributing
Contributions welcome. Please open an issue to discuss significant changes before submitting a PR.
License
MIT License. See LICENSE for details.