Agents
Identity, model, tools, inheritance, and orchestrating other agents.
An agent is a YAML file. Its name is its identity everywhere: in --agent, in agentName, in another agent's subagents list, in from:, and in traces. The filename means nothing.
The nine keys above are the whole vocabulary: name, from, description, model, tools, skills, subagents, mcp and system_instructions. Anything else fails the file at launch.
Instructions
SYSTEM.md is the package-wide instruction layer, and a root agent and every subagent start from it. Each agent's system_instructions then specializes it. mode: append composes after what it inherited; mode: replace discards both the inherited instructions and Pi's base prompt.
Derive agents with from:
Chains may be several levels deep. A missing base or a cycle is a validation error at launch. Inheritance and delegation are separate: from: inherits a definition, and it does not make that agent reachable. A root must still name it in subagents.
Inheritance rules
| Field | Derived-agent behavior |
|---|---|
description | Child replaces base; omission inherits |
model | Merges by key, unless the child declares model.name, which replaces the whole block |
tools | Child array replaces the allowlist; [] clears it |
skills | Child array replaces the selection; [] clears it |
subagents | Child array replaces visibility; [] clears it |
mcp | A declared child block replaces the whole inherited policy |
system_instructions | append composes after the base; replace discards it |
Arrays never merge item by item. A derived agent declaring tools: [read] receives only read, whatever its base listed. The model exception catches people out: restating model.name in a child drops the inherited temperature, retries and provider sections with it.
Model configuration
Those nine keys are the whole set. All are optional except name, and each merges by key along a from: chain.
Orchestrating other agents
There is no separate kind of agent for delegated work. Every agent in a package can be invoked directly, and the same file becomes a tool the moment a lead agent names it in subagents.
subagents is the last of those nine keys and the whole orchestration declaration. Recipes registers a single agent tool that accepts only those names. An agent with an empty or absent list gets no agent tool at all, so nothing orchestrates anything you did not say it could. Never list agent in tools; the subagents list is what enables it.
The agent tool
Starting a run returns a run id immediately instead of blocking, which is what lets a lead agent keep working while the agents it started run alongside it.
| Action | What it does |
|---|---|
omitted, or start | Runs the agent name with prompt, and returns a run id |
status | The state of one run, or of every run with no id |
wait | Blocks until that run settles, then returns its output |
message | Sends text into a run |
interrupt | Stops the current turn but keeps the run |
close | Ends the run and releases it |
label distinguishes concurrent runs of the same agent, which is what lets a lead start four at once and still tell the results apart. message does two useful things depending on when it lands: sent to a running agent it steers at the next message boundary rather than interrupting a tool call, and sent to one that has settled it resumes that same session with its context intact.
From your own process the same runs are readable on the handle:
What a child gets
- The same resolved snapshot as the root, so both read one source of truth.
- The child agent's own model, tools, skills and instructions.
- The root's model and credential binding, so nothing is configured twice.
- Its own MCP state. A parent does not inherit a child's connections, or the reverse.
- No
agenttool. Delegation is one level deep, so a run cannot fan out without bound.
Children run in-process by default with nothing to configure. A host can supply a durable, cross-process implementation of the same contract without touching the recipe. See Deploying.
Three rules worth stating twice
- Package extensions load for every agent session, root and delegated. What each agent can *see* is still only its own
tools. - MCP access is the intersection of package permission and agent selection, never the union.
- A host cannot silently override the model an agent declared.