Pi
Use Pi through AnyAgent: what you can ask for, how it behaves, and the flags underneath.
The pi adapter drives the Pi CLI as pi --mode json -p, detected as the pi binary on PATH; import pi from anyagent/pi. Pi is MIT-licensed and pure bring-your-own-key (BYOK), reading provider keys from around 20 env vars (OPENROUTER_API_KEY, ANTHROPIC_API_KEY, …).
What you can ask for
readOnly, model (as "provider/model"), effort (closed vocabulary: none, minimal, low, medium, high, xhigh, max), systemPrompt, resume, forkSession, and attachments all work on the CLI’s own flags; schema is provided by AnyAgent. Pi extends through its own extension system rather than MCP, so mcp throws. models() (pi --list-models) names this machine’s usable models, not a catalog, every id valid verbatim as model; authStatus() reads ~/.pi/agent/auth.json plus the provider key env vars, a hint rather than a guarantee. The full grid is on the support matrix.
Good to know
- Pi has no approval prompts and always runs autonomously;
readOnlyrestricts the toolset to thereadtool. - Pi’s
sessionevent opens the stream and the id lands onresult.sessionId;resumecreates the session if it is missing. - Usage arrives per turn, including cache line items, reasoning tokens, and cost.
Under the hood
Every run executes pi --mode json -p with the prompt piped over stdin. Run options append flags:
| Option | Flag |
|---|---|
readOnly: true | --tools read |
model | --model <provider/model> |
effort | --thinking <level>; "none" is sent as Pi’s off |
systemPrompt | --append-system-prompt <text> |
resume | --session-id <id> |
forkSession: true | --fork <id> in place of --session-id, branching the resumed session into a new one |
attachments | one @<path> positional per file, prompt still on stdin |