Skip to main content
Subagent delegation lets a parent agent spawn specialised workers with scoped permissions, timeouts, and parallel execution.
The user asks the coordinator; delegated subagents explore with scoped permissions.
For delegating to your own named agents defined in .praisonai/agents/*.md — by name, mid-run, with no Python — see Named Agent Delegation.
For agent-to-agent routing inside a conversation, prefer Handoffs. Use the subagent tool or delegator when you need programmatic spawn control, background jobs, or parallel fan-out.

Quick Start

1

Subagent Tool on an Agent

Attach create_subagent_tool so the parent can spawn workers:
2

Programmatic Delegator

For direct async control, use SubagentDelegator:

How It Works


Named Delegation from the CLI (--subagents)

A running agent can delegate sub-tasks to your own named agents in .praisonai/agents/*.md — by name, mid-run, with no Python. Each delegated agent runs the sub-task under its own model, tools, and permissions.
1

Create two named agents

Add a description: in each file’s frontmatter so the model knows what the agent is for. .praisonai/agents/researcher.md:
.praisonai/agents/writer.md:
2

Allow-list them at run time

The main agent can now call spawn_subagent(agent_name="researcher", ...) and the resolver runs your researcher agent under its own definition.

Two ways to expose a named agent

Opt any discovered agent in from the CLI without editing it:
The allow-list takes precedence over the frontmatter marker.

How resolution works

When the target name is unknown, the resolver returns nothing and the tool falls through to the existing generic-spawn behaviour — so a typo never breaks the run.

--subagents vs mode: subagent

Backward compatible. With no --subagents allow-list and no mode: subagent marker, no named resolver is wired and delegation behaves exactly as before — identical generic-spawn behaviour (agent_resolver=None).
--subagents applies when running a custom agent (for example praisonai run "<task>" --agent path/to/agent.md). Named agents are discovered from ~/.praisonai/agents/ and every .praisonai/agents/ up to the repo root.

Built-in Agent Profiles


Parallel Delegation

With per-task context:

Configuration Options


Model and Permission Modes

See Subagent Tool for create_subagent_tool parameters and background mode.

Task Management


Convenience Function


Best Practices

Use explorer for read-only scans, coder for implementation, and reviewer for quality checks.
Prevent runaway subagents with default_timeout_seconds or per-call overrides.
Keep max_concurrent_subagents low to avoid overwhelming APIs or local resources.
Use permission_mode="plan" when subagents should not modify files.

Delegating to Your Named Agents

Beyond the built-in profiles, a running agent can delegate to your own named agents in .praisonai/agents/*.md — picked by name, each running under its own model, tools, and permissions. Mark an agent with mode: subagent or opt agents in per run with praisonai run --subagents a,b,c.
The dedicated Named Agent Delegation page owns this topic in full.

Named Subagents

Delegate to your own named agents by name — one Markdown file each

Subagent Tool

Spawn subagents from a parent agent’s tool list

Spawn & Announce

Non-blocking parallel sub-agent orchestration

Agent Profiles

Built-in profile definitions

Handoffs

Conversation-based agent routing