phi-agent — Rust AI Agent Framework
Rust AI Agent runtime framework — orchestration, sessions, streaming all built-in. You only define tools, prompts, and domain knowledge.
phi-agent ships with zero application tools. No web search, no database connector, no code executor — just a clean Rust runtime. What tools your agent needs is entirely up to you. Kernel primitives (file I/O, shell, sub-agents) are available via
phi-kernel-toolsas opt-in infrastructure behind feature flags. File tools and MCP are on by default; shell and multi-agent are opt-in.
Built on agent-base and agent-works. phi-agent provides the infrastructure. You bring the tools.
Ecosystem
Just need the runtime? cargo add agent-base. Want the full framework? cargo add phi-agent.
Architecture
graph TB
AB[agent-base<br/>Tool trait · Runtime<br/>LLM clients · Events]
AB --> AW[agent-works<br/>MCP · Skills · Focus]
AB --> PKT["phi-kernel-tools<br/>Kernel tools"]
AB --> YT[your-tools<br/>Custom Tool impls]
AW --> PA
PKT --> PA
YT --> PA
PA[phi-agent<br/>Builder factory<br/>Renderers · Config · Session<br/>CLI binary]
Kernel Tools & Protocols
All opt-in via feature flags. file and mcp are enabled by default; shell and multi-agent are off.
| Feature | Capability | Default |
|---|---|---|
file |
Read, write, list files + skills | On |
mcp |
Model Context Protocol support | On |
shell |
Execute shell commands | Off |
multi-agent |
Spawn sub-agents | Off |
browser |
Browser automation via CDP | Off |
Feature groups (convenience bundles):
| Group | Includes | In full? |
|---|---|---|
protocol |
mcp |
Yes |
observability |
telemetry + logging |
Yes |
app |
browser |
No |
full |
file + shell + mcp + telemetry + logging |
— |
telemetry and logging are in the default set. app (browser) is intentionally excluded from full — add it explicitly when needed. multi-agent is always opt-in, not included in any group.
Why phi-agent
Your domain, your rules. Agent loop, session management, streaming events, tool routing, approval hooks — the framework does it all. You write zero glue code and focus on domain logic.
Single binary. Compile to one file, drop it in, run it. cargo install phi-agent — that's it.
Every step auditable. Every LLM call, every tool execution, recorded as JSONL. Sessions are snapshot-able, behavior is traceable, issues are debuggable.
Quick Start
use ;
use Arc;
async
More examples in examples/.
CLI
# Basic install (file + MCP + telemetry + logging)
# With shell execution (most common)
# Everything except browser
# Everything including browser
Development (from source):
&&
# REPL mode
# JSON output
Documentation
| Getting Started | Custom Tools |
| Kernel Tools | MCP |
| Multi-Agent | Skills |
| Session & Snapshots | Observability |
| Configuration | API Reference |
Contributing
See CONTRIBUTING.md.
Contributors ✨
Thanks goes to these wonderful people:
(emoji key) — This project follows the all-contributors specification.
License
MIT — see LICENSE.