Not another AI Agent, but an open application framework for building Agents — purpose-built for embedded, edge, and vertical industries, equally suited for highly customizable, high-performance cloud and desktop AI applications. Simple, pure, predictable.
Unlike LangChain, CrewAI, or AutoGen, phi-agent ships with zero built-in tools. No pre-packaged toolkits, no hidden prompt engineering, no magic workflow engine — just a clean Rust runtime. You define every tool, you control every behavior.
Built on agent-base and agent-works. phi-agent provides the infrastructure. You bring the tools.
Ecosystem
phi-agent is part of a family of independent crates:
Just need the runtime? cargo add agent-base. Need the full framework? cargo add phi-agent.
SDKs
Prefer Python? phi-agent supports multiple languages — write tools in your favorite language, powered by the same Rust runtime.
| Language | Package | Version |
|---|---|---|
| Python | pip install phi-agent |
Python
"""Search the web."""
return f
=
The Python SDK communicates with the phi Rust binary over stdio — you write tools in Python, and the Rust runtime handles the agent loop, LLM calls, and event streaming.
Architecture
graph TB
AB[agent-base<br/>Tool trait · Runtime<br/>LLM clients · Events]
AB --> AW[agent-works<br/>MCP · Skills · Focus]
AB --> PT[phi-tools<br/>LocalShellTool]
AB --> YT[your-tools<br/>Custom Tool impls]
AW --> PA[phi-agent<br/>Builder factory<br/>Renderers · Config · Session<br/>CLI binary]
PT --> PA
YT --> PA
PA --> Terminal[Terminal REPL]
PA --> JSON[JSON Stream]
PA --> Web[Web Backend]
Core principle: phi-agent ships with zero built-in tools. You define them, you register them. phi-agent discovers and manages them at runtime — listing, logging, and routing tool calls automatically.
Why phi-agent
Built for Vertical Scenarios. Not a generic chatbot, but an Agent framework for embedded systems, industrial, IoT, and other vertical domains, as well as desktop and cloud applications that demand deep customization — your scenario, your tools, your full control.
Lightweight, Runs Anywhere. A single Rust binary with zero runtime dependencies — from embedded Linux and edge gateways to cloud containers and desktop applications, cargo install gets you started in seconds, deploy anywhere.
Zero Built-in Tools, Fully Customizable. No pre-packaged tools, no platform lock-in — a tool is just 3 methods: name(), definition(), call(), you register what you need, the Agent uses what you register, only bring what your scenario truly needs, LLM freedom, precise and clean.
Fully Observable, Every Step Explainable. Every decision is logged, every step is traceable, with built-in session logging, structured tracing, and session metrics at a glance — compliance and audit trails without the stress.
Features
- Builder factory —
base_agent_builder()with sensible defaults (thinking, recovery, limits) - Three renderers — Terminal (rich, colored, streaming), JSON stream (JSONL), Null (silent)
- CLI-ready — REPL and one-shot modes with 20+ configurable flags
- Session management — auto-cleanup, file locking, JSONL turn logging
- Tool-agnostic — no built-in tools; register your own via
AgentBuilder - Extensible — middleware, approval handlers, custom renderers
Quick Start
use ;
use Arc;
async
See examples/ for more complete examples.
CLI
# REPL mode
# JSON output for scripting
Browser Automation
phi-agent includes 21 browser tools (gated behind the browser Cargo feature) for web browsing, form interaction, and data extraction via Chrome DevTools Protocol.
Quick Start
# Build and run with browser enabled
# Headed mode (visible browser window, useful for debugging)
# Connect to an existing Chrome instance
# First, start Chrome with remote debugging:
# /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --remote-debugging-port=9222
Available Browser Tools (21)
| Category | Tools |
|---|---|
| Navigation | browser_navigate, browser_go_back, browser_go_forward, browser_wait |
| Interaction | browser_click, browser_hover, browser_input_fill, browser_select, browser_press_key, browser_scroll |
| Viewing | browser_snapshot, browser_screenshot, browser_get_markdown, browser_read_links, browser_evaluate |
| Tab | browser_new_tab, browser_tab_list, browser_switch_tab, browser_close_tab |
| Control | browser_close, browser_extract_content |
How It Works
--enable-browserlaunches a headless Chrome instancebrowser_navigateopens a URL and returns an ARIA accessibility snapshot with numbered interactive elements- The AI clicks elements by index (e.g.,
browser_click index=5) instead of writing fragile CSS selectors browser_screenshotcaptures visual snapshots;browser_get_markdownextracts readable content
Requirements
- Chrome or Chromium installed
cargo run --features browser(thebrowserfeature gates the heavyheadless_chromedependency)
Custom Tool Example
use ;
use ;
use async_trait;
;
Full guide: guide/custom-tool.md
Documentation
📖 Full documentation: docs.phi-agent.dev
| Document | Description |
|---|---|
| Getting Started | 5-minute quick start |
| Custom Tools | How to write a Tool |
| CLI Usage | CLI flags, REPL, one-shot |
| Configuration | Config reference |
| Focus | Structured single-purpose LLM calls |
| Architecture | Design decisions and internals |
| Observability | Logging, tracing, metrics |
| Advanced | Middleware, sessions, event log |
FAQ
Q: What's the difference between phi-agent and agent-base?
agent-base is the runtime kernel (LLM calls, tool orchestration, event stream). phi-agent wraps it with a builder factory, renderers, config resolution, and session management — plus a CLI binary.
Q: Can I use phi-agent without the CLI?
Yes. Import it as a library (phi_agent) and use PhiAgent::build() programmatically. The CLI is just one consumer.
Q: How do I add my own tools?
Implement the Tool trait from agent-base and register with builder.register_tool(...). phi-agent has zero knowledge of what tools exist.
Q: Does phi-agent support Anthropic / other providers?
Yes. agent-base provides AnthropicClient and OpenAiClient. Any client implementing LlmClient works.
Contributing
See CONTRIBUTING.md for detailed setup instructions and PR guidelines.
Contributors
Thanks goes to these wonderful people:
(emoji key) — This project follows the all-contributors specification.
License
MIT — see LICENSE for details.
Contact
:material-email-outline: phiagent@hibuka.com