Skip to content

Subagents Capability Specification

Capability Identity

PropertyValue
EnumA2ECapability.MULTI_AGENT
String"multi_agent"
Plugin TypeSubagentPlugin
NamespaceSUBAGENT_* (uppercase)
Message Count12

Overview

The subagents capability provides multi-agent orchestration — spawning, delegating tasks to, communicating with, and merging results from child agents. Subagents run as independent agent instances with their own model, system prompt, capabilities, and execution scope.

Key concepts:

  • Spawn — Create a new subagent with a specific configuration
  • Delegate — Assign a task to a spawned subagent
  • Await — Block until a subagent completes its task
  • Message — Send inter-agent messages between subagents
  • List — Query all active subagents
  • Cancel/Terminate — Stop a running subagent
  • Merge — Combine results from multiple subagents

Isolation model:

  • Memory: shared, isolated, or snapshot scope
  • Tools: shared, restricted, or isolated scope
  • Depth limit: Prevents infinite nesting

Protocol Flow

Message Types (12)

Spawn (2)

SUBAGENT_SPAWN_REQ — SubagentSpawnRequest

Parent → Host. Create a new subagent instance.

FieldTypeRequiredDefaultDescription
typestrYes"SUBAGENT_SPAWN_REQ"Message type
agentSubagentConfigYesSubagent configuration
parent_agent_idstrNoNoneParent agent identifier
root_agent_idstrNoNoneRoot agent (for multi-level nesting)

SUBAGENT_SPAWN_RESP — SubagentSpawnResponse

Host → Parent.

FieldTypeRequiredDefaultDescription
typestrYes"SUBAGENT_SPAWN_RESP"Message type
subagent_idstrYesAssigned subagent identifier (sub_{hex[:8]})
statusSubagentStatusYesInitial status (READY)

Delegate (2)

SUBAGENT_DELEGATE_REQ — SubagentDelegateRequest

Parent → Host. Assign a task to a subagent.

FieldTypeRequiredDefaultDescription
typestrYes"SUBAGENT_DELEGATE_REQ"Message type
subagent_idstrYesTarget subagent
taskTaskDefinitionYesTask to execute

SUBAGENT_DELEGATE_RESP — SubagentDelegateResponse

Host → Parent.

FieldTypeRequiredDefaultDescription
typestrYes"SUBAGENT_DELEGATE_RESP"Message type
acceptedboolNoTrueWhether the task was accepted
statusSubagentStatusYesSubagent status after delegation

Await (2)

SUBAGENT_AWAIT_REQ — SubagentAwaitRequest

Parent → Host. Block until subagent completes.

FieldTypeRequiredDefaultDescription
typestrYes"SUBAGENT_AWAIT_REQ"Message type
subagent_idstrYesSubagent to wait for

SUBAGENT_AWAIT_RESP — SubagentAwaitResponse

Host → Parent.

FieldTypeRequiredDefaultDescription
typestrYes"SUBAGENT_AWAIT_RESP"Message type
subagent_idstrYesSubagent identifier
statusSubagentStatusYesFinal status
resultdict[str, Any]NoNoneTask result
errorstrNoNoneError message if failed

Message (2) — Inter-agent Communication

SUBAGENT_MESSAGE_REQ — SubagentMessageRequest

Agent → Host. Send a message between subagents.

FieldTypeRequiredDefaultDescription
typestrYes"SUBAGENT_MESSAGE_REQ"Message type
from_subagent_idstrYesSender subagent
to_subagent_idstrYesRecipient subagent
messageSubagentMessagePayloadYesMessage payload

SUBAGENT_MESSAGE_RESP — SubagentMessageResponse

Host → Sender.

FieldTypeRequiredDefaultDescription
typestrYes"SUBAGENT_MESSAGE_RESP"Message type
deliveredboolNoTrueWhether message was delivered

List (2)

SUBAGENT_LIST_REQ — SubagentListRequest

Agent → Host. List all subagents.

FieldTypeRequiredDefaultDescription
typestrYes"SUBAGENT_LIST_REQ"Message type

SUBAGENT_LIST_RESP — SubagentListResponse

Host → Agent.

FieldTypeRequiredDefaultDescription
typestrYes"SUBAGENT_LIST_RESP"Message type
subagentslist[SubagentInfo]YesList of active subagents

Cancel/Terminate (2) — No Response Messages

SUBAGENT_CANCEL_REQ — SubagentCancelRequest

Agent → Host. Request graceful cancellation of a subagent.

FieldTypeRequiredDefaultDescription
typestrYes"SUBAGENT_CANCEL_REQ"Message type
subagent_idstrYesSubagent to cancel

SUBAGENT_TERMINATE_REQ — SubagentTerminateRequest

Agent → Host. Forcefully terminate a subagent.

FieldTypeRequiredDefaultDescription
typestrYes"SUBAGENT_TERMINATE_REQ"Message type
subagent_idstrYesSubagent to terminate

Merge (2)

SUBAGENT_MERGE_REQ — SubagentMergeRequest

Agent → Host. Merge results from multiple subagents.

FieldTypeRequiredDefaultDescription
typestrYes"SUBAGENT_MERGE_REQ"Message type
subagent_idslist[str]YesSubagents to merge
strategystrNo"hierarchical_summary"Merge strategy

Merge strategies:

StrategyDescription
hierarchical_summaryParent summarizes child results
votingMajority vote across results
customHost-defined merge strategy

SUBAGENT_MERGE_RESP — SubagentMergeResponse

Host → Agent.

FieldTypeRequiredDefaultDescription
typestrYes"SUBAGENT_MERGE_RESP"Message type
merged_resultdict[str, Any]YesMerged output

Events (1) — Server-initiated

SUBAGENT_EVENT — SubagentEvent

Host → Agent. Subagent lifecycle event.

FieldTypeRequiredDefaultDescription
typestrYes"SUBAGENT_EVENT"Message type
subagent_idstrYesSource subagent
eventstrYesEvent type identifier
contentdict[str, Any]No{}Event payload

Data Models

SubagentConfig

FieldTypeRequiredDefaultDescription
namestrYesSubagent name
rolestrNoNoneRole descriptor
modelstrYesLLM model identifier
system_promptstrNoNoneCustom system prompt
capabilitieslist[str]No[]Enabled capabilities
memory_scopeMemoryScopeNoSHAREDMemory isolation level
tool_scopeToolScopeNoRESTRICTEDTool access level
max_stepsintNo40Maximum agent steps
timeout_secondsintNo600Execution timeout
metadatadict[str, Any]No{}Additional metadata

TaskDefinition

FieldTypeRequiredDefaultDescription
namestrYesTask name
instructionstrYesTask instruction for the subagent
success_criterialist[str]No[]Criteria for task completion
metadatadict[str, Any]No{}Additional task metadata

SubagentInfo

FieldTypeRequiredDefaultDescription
subagent_idstrYesSubagent identifier
namestrYesDisplay name
statusSubagentStatusYesCurrent status
parent_agent_idstrNoNoneParent agent
root_agent_idstrNoNoneRoot agent
depthintNo0Nesting depth
configSubagentConfigYesFull configuration

SubagentMessagePayload

FieldTypeRequiredDefaultDescription
typestrYesMessage type identifier
contentAnyYesMessage content

SourceRef

FieldTypeRequiredDefaultDescription
session_idstrNoNoneSession reference
trajectory_idstrNoNoneTrajectory reference
turn_idstrNoNoneTurn reference

Enumerations

SubagentStatus

ValueDescription
READYSpawned but not yet executing a task
RUNNINGActively executing a delegated task
WAITINGWaiting for input or another subagent
COMPLETEDTask finished successfully
FAILEDTask finished with error
CANCELLEDTask was gracefully cancelled
TERMINATEDTask was forcefully terminated

MemoryScope

ValueDescription
sharedSubagent shares parent's memory
isolatedSubagent has its own memory namespace
snapshotSubagent gets a copy of parent's memory at spawn time

ToolScope

ValueDescription
sharedFull access to parent's tools
restrictedLimited tool access (host policy)
isolatedCompletely separate tool namespace

Execution Model

SubagentRuntime

Each subagent is managed by a SubagentRuntime instance:

FieldTypeDescription
subagent_idstrUnique identifier
configSubagentConfigConfiguration
parent_agent_idstr or NoneParent reference
root_agent_idstr or NoneRoot reference
depthintNesting depth
statusSubagentStatusCurrent status
resultdict or NoneTask result
task_handleasyncio.Task or NoneRunning task handle

Lifecycle

  1. Spawn: Create runtime, set status = READY
  2. Delegate: Create asyncio.Task for run_task(), set status = RUNNING
  3. Execute: Agent adapter runs the task
  4. Complete: Set status = COMPLETED, store result
  5. Fail: Set status = FAILED, store error
  6. Cancel: Cancel asyncio.Task, set status = CANCELLED
  7. Terminate: Cancel asyncio.Task, set status = TERMINATED

Wire Examples

Spawn and Delegate

json
{"type":"SUBAGENT_SPAWN_REQ","agent":{"name":"researcher","role":"research","model":"claude-3.5-sonnet","system_prompt":"You are a research assistant","capabilities":["tools","memory"],"memory_scope":"isolated","tool_scope":"restricted","max_steps":40,"timeout_seconds":600,"metadata":{}},"parent_agent_id":"parent_1","root_agent_id":"parent_1"}
json
{"type":"SUBAGENT_SPAWN_RESP","subagent_id":"sub_a1b2c3d4","status":"READY"}
json
{"type":"SUBAGENT_DELEGATE_REQ","subagent_id":"sub_a1b2c3d4","task":{"name":"research_topic","instruction":"Research the latest developments in quantum computing","success_criteria":["Include at least 3 recent papers","Provide a summary"],"metadata":{}}}
json
{"type":"SUBAGENT_DELEGATE_RESP","accepted":true,"status":"RUNNING"}

Await Result

json
{"type":"SUBAGENT_AWAIT_REQ","subagent_id":"sub_a1b2c3d4"}
json
{"type":"SUBAGENT_AWAIT_RESP","subagent_id":"sub_a1b2c3d4","status":"COMPLETED","result":{"summary":"Quantum computing advances in 2024 include...","papers":["paper1","paper2","paper3"]},"error":null}

Merge Results

json
{"type":"SUBAGENT_MERGE_REQ","subagent_ids":["sub_a1b2c3d4","sub_e5f6g7h8"],"strategy":"hierarchical_summary"}
json
{"type":"SUBAGENT_MERGE_RESP","merged_result":{"summary":"Combined findings from researcher and coder agents..."}}

Security Considerations

  1. Depth limiting: Host must enforce maximum nesting depth to prevent recursive spawning
  2. Memory isolation: isolated and snapshot scopes prevent cross-agent data leakage
  3. Tool restriction: restricted and isolated scopes limit dangerous tool access
  4. Timeout enforcement: timeout_seconds prevents runaway subagents
  5. Step limiting: max_steps prevents infinite agent loops
  6. Cancellation propagation: Cancel requests must propagate to all child subagents
  7. Resource quotas: Host should enforce per-session subagent count limits

A2E Protocol v1.0 — Released under the MIT License.