For delegating to your own named agents defined in
.praisonai/agents/*.md β by name, mid-run, with no Python β see Named Agent Delegation.For a single one-line tool an agent can call inside a prompt β no factory, no config β see the Delegate Task Tool. Reach for
parallel_handoffs or create_subagent_tool (this page and Subagent Tool) when you need parallel fan-out, background execution, or full model / permission control.For agent-to-agent routing inside a conversation, prefer Handoffs. Use the subagent tool when you need programmatic spawn control, background jobs, or full model / permission control; use
parallel_handoffs for async fan-out.Quick Start
1
Subagent Tool on an Agent
Attach
create_subagent_tool so the parent can spawn workers:2
Programmatic Handoffs
For direct async control, fan work out to focused agents with For a single target, use
parallel_handoffs:lead.handoff_to_async(explorer, "Find auth files").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
spawn_subagent(agent_name="researcher", ...) and the resolver runs your researcher agent under its own definition.Two ways to expose a named agent
- Allow-list flag (--subagents)
- Frontmatter marker (mode: subagent)
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
Fan work out to multiple agents at once withparallel_handoffs β each (agent, prompt) tuple runs concurrently:
Configuration Options
Parallel fan-out is tuned withHandoffConfig. The knobs you reach for most:
max_concurrent passed directly to parallel_handoffs overrides the value in HandoffConfig. See the full option list in the HandoffConfig reference.Model and Permission Modes
See Subagent Tool for
create_subagent_tool parameters and background mode.
Cancellation
A single async handoff is a coroutine β wrap it in your ownasyncio.Task and .cancel() it to stop it early:
parallel_handoffs bounds each target with timeout_seconds from HandoffConfig; cancel the outer task to stop the whole batch.
Best Practices
Match agent profiles to the task
Match agent profiles to the task
Use
explorer for read-only scans, coder for implementation, and reviewer for quality checks.Set timeouts on long tasks
Set timeouts on long tasks
Prevent runaway handoffs with
HandoffConfig(timeout_seconds=...).Limit concurrency
Limit concurrency
Keep
max_concurrent low to avoid overwhelming APIs or local resources.Prefer plan mode for exploration
Prefer plan mode for exploration
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.
Related
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

