Skip to Content
Platform
BuildDefine agents

Define agents

One YAML file per agent: its model, its tools, and who it can delegate to.

An agent is a YAML file in agents/ that turns the recipe’s shared instructions into one runnable role. Add a second agent when a task needs its own model, tools, or context.

You need: a recipe (Create a recipe).

agents/agent.yaml
name: agent description: Reviews refund requests and drafts the next response. ai: model: anthropic/<model> thinking_level: medium tools: [read, bash] skills: [refund-policy] subagents: [reviewer] system_instructions: mode: append content: | Ground every decision in the refund policy. Draft responses; never issue a refund.

name is the agent’s identity; the filename means nothing. The default agent is named agent. system_instructions adds to the shared SYSTEM.md (append) or replaces it (replace).

Fields

Only name (lowercase kebab-case) and ai.model are required (legacy model.name is still accepted in place of ai). Any other key fails the file.

FieldWhat it decides
descriptionWhen this role should be used.
fromThe agent this one derives from.
aimodel (<provider>/<model_id>), thinking_level, options (pi-ai request options in snake_case, such as cache_retention), providers (provider settings and routing). Credentials, headers, and networking are rejected. See Tune requests and caching.
sessionPi session policy: steering_mode, follow_up_mode, tool_execution, retry, compaction, images. Every key is validated; values are Pi settings .
toolsStrict allowlist of built-in tools and your tools. Omitted means none.
skillsSkills by name. Omitted means none.
mcpThis agent’s share of the recipe’s MCP grant.
subagentsAgents this one may delegate to.

1. Add a subagent

agents/reviewer.yaml
name: reviewer description: Independently checks a drafted refund decision. ai: model: anthropic/<model> tools: [read]

2. Let the lead agent delegate

List it in subagents. The delegation tool, agent, is added for you; do not put it in tools.

agents/agent.yaml
subagents: [reviewer]

The agent tool takes start (returns a run id at once), status, wait, message, interrupt, or close. A child has its own model, tools, and instructions, but shares the task’s sandbox, /workspace, credentials, and memory.

3. Make a variant

A variant derives from another agent and changes a few fields:

agents/agent-fast.yaml
name: agent-fast from: agent ai: model: anthropic/<smaller-model>

Pick it per task instead of editing the recipe:

introspection tasks create -r support-agent -e staging --agent agent-fast --prompt "Review order 1842."

The SDKs take the same choice as agent_name. A variant is not a delegate unless some agent lists it in subagents.

Inherited fieldRule
tools, skills, subagentsA declared list replaces the inherited one; [] clears it.
aiMerges by key, but declaring ai.model starts a fresh ai block.
sessionMerges by key.
mcpA declared block replaces the inherited one whole.
system_instructionsappend adds after the inherited text; replace discards it.

Verify

introspection check introspection local -p "Draft a decision for order 1842 and have it reviewed." introspection local --agent agent-fast -p "Review order 1842."

Expect an agent tool call that starts reviewer in the first run.

Limits

Not supportedDo this instead
Isolating a subagent’s files or credentialsSelection is not isolation. Run separate tasks or separate runtimes.
Unbounded fan-outConcurrency and depth are capped (Limits).

Or ask your agent: “Add a read-only reviewer subagent that checks each refund draft, and test it locally.”

Last updated on