pi
pi
The pi worker exposes the Pi coding-agent API as iii functions. One pi::run
call executes one headless Pi turn — the same in-process agent loop Pi runs in
the terminal, with the same tools (read, bash, edit, write) — in a chosen
working directory, and returns the final result, token usage, and cost. Every
event Pi emits mirrors untouched onto the pi::events stream; a translated
AgentEvent view lands on agent::events, which is what the iii console and the
acp worker render.
Pi runs the loop in-process (no CLI subprocess), so it needs model credentials
in the worker environment (e.g. ANTHROPIC_API_KEY) or an existing Pi login.
When a turn needs a capability beyond Pi itself, add another iii worker to the
bus instead of bolting anything onto this one.