.praisonai/agents/*.md — by name, mid-run, with no Python.
--subagents allow-list:
Quick Start
Mark an agent as delegatable
Add
mode: subagent to any agent’s frontmatter. The agent’s author opts it in once, and every run can delegate to it.Or opt agents in from the CLI
Pass
--subagents to expose exact agents for a single run, no frontmatter changes required.How It Works
The primary agent picks a teammate by name; a resolver instantiates that agent from its Markdown definition and runs the sub-task.Two ways to opt agents in
Choose per-agent frontmatter for stable teammates, or the CLI flag for ad-hoc runs.| Route | Set where | Scope | Best for |
|---|---|---|---|
mode: subagent | Agent frontmatter | Every run | Stable teammates you always want available |
--subagents a,b,c | CLI flag | Single run | Ad-hoc delegation without editing files |
--subagents is passed, those exact names are exposed regardless of mode. When it is omitted, every agent whose frontmatter has mode: subagent is exposed. If neither yields any agent, the spawn_subagent tool is not wired at all and the run is identical to before.
What the delegated agent inherits
Each named agent runs under its ownmodel, tools, and permissions from its frontmatter. The primary agent does not override them.
Generic spawn_subagent | Named agent delegation |
|---|---|
| Parent chooses the model, tools, and permission mode per call | Each named agent brings its own model, tools, and permissions |
| Spawns a generic worker | Runs your pre-defined .praisonai/agents/*.md agent |
mode: subagent marker never changes its permissions — it only marks the agent as delegatable (see Delegatability vs permissions).
How the model discovers them
The tool description lists each delegatable agent so the primary model can pick one by purpose:description, falling back to goal, then role, then an empty string when none is set. Give every delegatable agent a clear goal or description so the primary model chooses the right teammate.
Fallback behaviour
Delegation is purely additive — nothing changes when there is nothing to delegate to.- Unknown name: if
agent_nametargets a name the resolver cannot find, the resolver returnsNoneand the existing generic-spawn path runs instead. - No delegatable agents: if no agent is marked
mode: subagentand--subagentsis omitted, thespawn_subagenttool is not wired at all — the run is byte-identical to before.
Delegatability vs permissions
mode: subagent is a delegatability marker, not a permission mode. It is ignored (case-insensitive) when computing permissions, so it is never rejected as an unknown mode. Any other mode value — read-only, plan, accept-edits — still flows through the permission engine as before. See Custom Agents & Commands for the full mode reference.
Configuration Options
| Option | Type | Default | Description |
|---|---|---|---|
agent_resolver | Callable[[str], Agent] | None | SDK callback that returns a ready-to-run Agent for a name. When a passed agent_name resolves, that named agent runs the sub-task under its own model/tools/permissions. None preserves generic-spawn behaviour. |
resolvable_agents | Dict[str, str] | None | SDK {name: description} map of delegatable agents; each entry enriches the tool description so the model can pick one. |
--subagents | CLI flag | — | Comma-separated named agents (.praisonai/agents/*.md) the running agent may delegate to. Omit to expose agents marked mode: subagent. |
agent_resolver and resolvable_agents are SDK parameters on create_subagent_tool. The CLI wires them for you from your .praisonai/agents/ definitions — you only need mode: subagent or --subagents.Common Patterns
- Researcher + Reviewer
- One-off CLI allow-list
- Mixing markers + override
A lead delegates to two teammates marked The lead calls
mode: subagent:spawn_subagent(agent_name="researcher") and spawn_subagent(agent_name="reviewer"), each running under its own frontmatter.Best Practices
Prefer mode: subagent for stable teammates, --subagents for ad-hoc runs
Prefer mode: subagent for stable teammates, --subagents for ad-hoc runs
Mark agents you always want available with
mode: subagent and commit them to git. Reach for --subagents when you need a one-off delegation without editing files.Give each named agent a clear description or goal
Give each named agent a clear description or goal
The primary model picks teammates by their
description (falling back to goal, then role). A vague goal makes the model guess; a specific one routes the right sub-task to the right agent.Use permission blocks to sandbox delegated agents
Use permission blocks to sandbox delegated agents
Each named agent runs under its own
permissions. Add a permission: block (or a mode: like read-only) to a delegated agent to sandbox its side-effects independently of the primary agent.Keep delegation shallow
Keep delegation shallow
A delegated agent chatting to finish its sub-task is fine. Nested delegation — a delegated agent delegating again — is not part of this feature; design flat teams with a single coordinating agent.
Related
Subagent Tool
The create_subagent_tool seam and its parameters
Subagent Delegation
Programmatic spawn control and parallel fan-out
Custom Agents & Commands
Define named agents in .praisonai/agents/*.md
Handoffs
Agent-to-agent routing inside a conversation

