🤖 pi-agents
Give Pi durable, named agents. Delegate a job, keep working
while the agent runs, and get its result back as a message. Watch any agent
live, talk to it, or stop it. Agents survive crashes and restarts.
 |
 |
Delegate work to agents and graphs
Run parallel reviews, follow progress, and bring the findings together.
|
Agents message each other
Coordinate a fix between agents, then browse their conversation.
|
🚀 Installation
pi install npm:pi-agents
✨ Usage
Have an agent review src/run for error handling while we keep going.
Spawn two agents in parallel: one maps the API surface, one checks the tests.
Merge their findings once both report back.
Start a graph: three agents review src/run, src/ui, and src/host, and a
fourth merges their findings into one list of issues.
Start an agent that may spawn agents: it finds every module under src, has
one agent review each, and returns one merged review.
Pi starts agents only when you ask for delegation. They work in the
background and return their final messages to your conversation. In a
graph, agents pass results to each other and Pi gets one message at the end.
🏗️ Architecture
Agents run inside Pi and use your Pi logins, models, MCP servers, and the
extension tools you share with them:
╭─ Pi process ─────────────────────────────────────────────────────────╮
│ │
│ ╭──────────────────╮ ╭────────────────────╮ ╭────────────────╮ │
│ ╭┤ ◆ Pi session: │ │ ◇ optional │ │ ▤ panel │ │
│ ┊│ MCP, extension │ │ extensions, e.g. │ │ ⇄ attach view │ │
│ ┊│ tools │ │ pi-service-tier │ │ ≡ /agents │ │
│ ┊│ │ │ │ │ ✉ /messages │ │
│ ┊╰───┬─────────▲────╯ ╰─────────┬──────────╯ ╰────────▲───────╯ │
│ ┊ │ agent_* │ results ╎ hooks: capture at │ │
│ ┊ │ │ ╎ spawn, hold calls, │ │
│ ┊ ▼ │ ▼ adapt requests │ │
│ ┊╭─────────────┴──────────────────────────────────────┴───────╮ │
│ ┊│ ✦ pi-agents: a thin bridge from Pi to pi-durable │ │
│ ┊│ │ │
│ ┊│ ◈ tool twin: a headless, non-durable Pi session that runs ├───╮ │
│ ┊│ MCP and shared extensions, whose tools only run in Pi │ │ │
│ ┊╰───┬─────────▲───────────────────────────▲──────────────────╯ │ │
│ ┊ │ start │ state │ tool calls │ │
│ ┊ │ message │ results │ │ │
│ ┊ ▼ stop │ │ │ │
│ ┊╭─────────────┴───────────────────────────┴──────────────────╮ │ │
│ ┊│ pi-durable harness │ │ │
│ ┊│ │ │ │
│ ┊│ ◉ scout ─── message ──▶ ● notes │ │ │
│ ┊│ │ │ │
│ ┊│ ╭─ graph ─────────────────────────╮ agent tools: │ │ │
│ ┊│ │ ● map ─┬─▶ ◉ core ─┬─▶ ○ report │ read bash edit │ │ │
│ ┊│ │ └─▶ ◉ ui ───┘ │ write grep find │ │ │
│ ┊│ │ └─ ◉ ◉ ◉ spawned │ ls codemode, and │ │ │
│ ┊│ ╰─────────────────────────────────╯ the twin's tools │ │ │
│ ┊│ │ │ │
│ ┊│ agents are conversations; turns, tool calls, and graphs │ │ │
│ ┊│ are durable tasks that own what they start; model │ │ │
│ ┊│ requests pass the hooks with each agent's snapshot │ │ │
│ ┊╰─────────────────────────────┬──────────────────────────────╯ │ │
╰─┬──────────────────────────────┬──────────────────────────────────┬──╯
┊ saves │ checkpoint every step │ connects
▼ ▼ ▼
╭──────────────────────╮ ╭──────────────────────────────╮ ╭─────────────╮
│ ▤ Pi's session file │ │ ▤ pi-agents store, one per │ │ ◎ MCP │
│ your conversation, │ │ session: agents and their │ │ servers, │
│ saved results, and │ │ hook snapshots, graphs, │ │ web │
│ message cards │ │ messages, tasks │ │ providers │
╰──────────────────────╯ ╰──────────────────────────────╯ ╰─────────────╯
📚 Documentation
- Usage: glossary, states, skills, UI, commands, and tools.
- Graphs: coordinating agents, and agents that spawn agents.
- Messaging: using messages and their guarantees.
- Agent profiles: reusable settings and instructions.
- Configuration: models, requests, and footer counts.
- Architecture: recovery, storage, and lifecycle events.
- Extension hooks: capture settings, hold calls, and adapt requests.
评论