Mechanism layers
Four orthogonal concerns combine into a complete harness
L1 Loop & Action
Loop and action. pi ships the agent loop; here you give it hands, draw a boundary, and hang hooks on it.
AgentSession
pi already runs the loop
One prompt() is a whole agent loop; pi already turns it for you.
Custom tools
Add a capability, add one handler
Add a capability, add just one handler.
Permission gate
Draw the boundary first, then hand over freedom
Draw the boundary first, then hand over freedom.
Events and hooks
Hang on the loop, do not write into it
Observe with events, intervene with hooks, never touch the main loop.
L2 Knowledge & Context
Knowledge and context. On-demand skills, prompt templates, session branching and compaction are all, at heart, managing a finite context.
On-demand skills
Load it when you need it
Only names and descriptions are resident; the body is read on a hit.
Prompt templates
A slash command for a common instruction
Standardize how to ask, too.
Sessions and branching
Context fills up; save and fork it
A session is a tree, not a straight line.
L3 Delegation & Integration
Delegation and integration. Isolate tasks with subagents, drive pi across processes with RPC, and connect any model with a custom provider.
Subagents
Give a subtask a brand-new messages[]
Trade context budget for focus.
RPC integration
Drive pi from any program with JSONL
Commands in on stdin, events out on stdout.
Custom providers
The model is not only from one vendor
pi's model layer is open.
L4 Distribution & Integration
Distribution and integration. Pack tools, skills, and templates into one installable unit, then assemble the machine.