with one click
subagents
Spawn isolated agents and communicate across sessions
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Menu
Spawn isolated agents and communicate across sessions
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Based on SOC occupation classification
store and retrieve long-term memories (facts, preferences, context)
Create and manage agents with isolated sessions and routing
Core behavior guidelines for agent interactions
Handle images, audio, and document files for messaging channels
Automate web browsing, scraping, and form interaction
Create and manage persistent interactive workspaces
| name | subagents |
| description | Spawn isolated agents and communicate across sessions |
| trigger | on-demand |
Multi-agent system for spawning isolated workers and coordinating across sessions.
| Rule | Reason |
|---|---|
Use spawn_subagent for complex/parallel tasks | Don't overload main context |
DO NOT use scheduler when asked for subagent | Different tools |
Wait for result with wait_subagent | If you need the result |
| Use descriptive labels | Easier identification |
User: "create a subagent to create a skill"
Agent: Uses scheduler(action=add)
Agent: Creates schedule
User: "create a subagent to create a skill"
Agent: spawn_subagent(task="Create skill...", label="skill-creator")
Main Agent
(Current Session)
|
+-----------------+-----------------+
| |
v v
+-----------------+ +-----------------+
| SPAWNING | | COMMUNICATION |
+-----------------+ +-----------------+
| spawn_subagent | | sessions |
| list_subagents | | (action=list) |
| wait_subagent | | (action=send) |
| stop_subagent | | (action=export)|
+---------+-------+ | (action=delete)|
| +--------+--------+
v v
+-----------------+ +-----------------+
| Subagent Run | | Existing Session|
| (isolated) | | (another agent) |
| - New session | | - Separate chat |
| - Limited ctx | | - Cross-agent |
| - Reports back | | messaging |
+-----------------+ +-----------------+
| Mode | Tools | Purpose |
|---|---|---|
| Spawning | spawn_subagent, list_subagents, wait_subagent, stop_subagent | Create new isolated agents |
| Communication | sessions(action=list/send/export/delete) | Talk to existing agents |
| Scenario | Use spawn_subagent |
|---|---|
| Long research task | Yes |
| Multiple parallel tasks | Yes |
| Create skills/plugins | Yes |
| Complex analysis | Yes |
| Background processing | Yes |
| Scenario | Alternative |
|---|---|
| Schedule task for specific time | scheduler(action=add) |
| Reminder | scheduler(action=add, type=at) |
| Communicate with existing agent | sessions(action=send) |
spawn_subagent(
task="Create a skill for ViaCEP API. When user provides a CEP, fetch and return address information.",
label="viacep-skill-creator"
)
# Output: Subagent spawned with ID: sub_abc123
list_subagents()
# Output:
# Subagents (2):
# - sub_abc123 [viacep-skill-creator]: running, 2m elapsed
# - sub_def456 [research-api]: completed, 45s
wait_subagent(subagent_id="sub_abc123", timeout=300)
# Output:
# Subagent completed.
# Result: Skill 'viacep' created successfully...
stop_subagent(subagent_id="sub_abc123")
# Output: Subagent sub_abc123 stopped
# Spawn and continue working
spawn_subagent(
task="Generate weekly report and save to reports/ folder",
label="reporter"
)
# Continue with other tasks...
# Check later with list_subagents()
# Spawn
spawn_subagent(
task="Analyze logs for errors in the past 24 hours",
label="log-analyzer"
)
# Wait for result (blocks until complete)
result = wait_subagent(subagent_id="sub_abc123", timeout=600)
# Use the result...
# Spawn multiple subagents
spawn_subagent(task="Research topic A", label="research-a")
spawn_subagent(task="Research topic B", label="research-b")
spawn_subagent(task="Research topic C", label="research-c")
# Check status
list_subagents()
# Wait for each
result_a = wait_subagent(subagent_id="sub_001")
result_b = wait_subagent(subagent_id="sub_002")
result_c = wait_subagent(subagent_id="sub_003")
sessions(action="list")
# Output:
# Active sessions (3):
# - [whatsapp] 5511999999 (id: abc123, ws: main) -- 15 msgs -- last active: 2m ago
# - [webui] user-session (id: def456, ws: dev) -- 8 msgs -- last active: 5m ago
sessions(
action="send",
session_id="abc123",
message="Task completed. Results saved to output.md",
sender_label="research-agent"
)
# Output: Message delivered to session abc123 (channel: whatsapp).
sessions(action="export", session_id="abc123")
# Output:
# {
# "session_id": "abc123",
# "messages": [...],
# "metadata": {...}
# }
# User: "create a subagent to create a skill for https://viacep.com.br/"
# 1. Spawn subagent (NOT scheduler!)
spawn_subagent(
task="Create skill for ViaCEP API (https://viacep.com.br/).
The skill should:
1. Accept CEP from user
2. Fetch information from API
3. Return formatted address
Include script to make the request.",
label="viacep-skill"
)
# 2. Check status
list_subagents()
# 3. Wait for result
result = wait_subagent(subagent_id="sub_abc", timeout=300)
# 4. Inform user
send_message("ViaCEP skill created! " + result)
# 1. Spawn research agent
spawn_subagent(
task="Research best practices for GraphQL pagination. Include cursor-based and offset-based approaches.",
label="research-graphql"
)
# 2. Continue main work
# ... do other tasks ...
# 3. Check status
list_subagents()
# 4. Get results when ready
wait_subagent(subagent_id="sub_abc123")
# 1. Find collaborator session
sessions(action="list")
# 2. Request help
sessions(
action="send",
session_id="backend-agent-session",
message="Need API endpoint for user preferences. Can you create GET /api/user/preferences?",
sender_label="frontend-agent"
)
# Backend agent responds via sessions(action=send) to your session
| Aspect | Behavior |
|---|---|
| Context | Limited bootstrap (AGENTS.md + TOOLS.md only) |
| Session | Separate from spawner |
| Result | Announced back to requester chat |
| Lifetime | Until completed or stopped |
Cause: Task taking longer than timeout.
Solution:
# Increase timeout
wait_subagent(subagent_id="sub_abc", timeout=600) # 10 minutes
# Or check status without waiting
list_subagents()
Cause: Confusion between spawn and scheduler.
Correction:
Cause: Session doesn't exist or wrong ID.
Solution:
sessions(action="list") # List all first
| Mistake | Correction |
|---|---|
Using scheduler when asked for subagent | Use spawn_subagent |
| Not checking list_subagents | Verify status |
| Waiting without timeout | Always set timeout |
| Vague task in spawn | Be specific about expected output |
| Not stopping stuck agents | Clean up with stop_subagent |