A2A Protocol
Talon’s Agent-to-Agent (A2A) protocol lets personas delegate tasks to each other over the internal durable queue. No external orchestration needed — delegation is just a tool call.
Talon uses the task model of Google’s A2A protocol for internal routing only. It runs in-process and is not wire-compatible. There is no network endpoint and no streaming.
How it works
Section titled “How it works”- Persona A calls
persona_sendwith a target persona name and a message - Talon stores the task in the
a2a_taskstable and enqueues acollaborationqueue item for persona B - Persona B picks it up, runs its agent, and optionally returns a result
- If
await_reply: true, persona A’s tool call blocks until the reply arrives or the wait times out
The queue handles durability and crash recovery. Collaboration items bypass the inflight lock so they can be processed even while the source persona’s run is still active. A run that waits in persona_send or persona_task_status releases its queue.concurrencyLimit slot until it resumes, so Talon can always dispatch the delegated task.
:::tip Provider isolation Delegated A2A tasks always run on the target persona’s configured provider, regardless of which provider the source thread was using. This prevents provider affinity contamination and ensures each persona runs on its intended model. :::
Capability requirement
Section titled “Capability requirement”Four host tools handle delegation: persona_send, persona_task_status, persona_task_cancel, and persona_list. One capability family grants all four: persona.send:* or a scoped persona.send:<persona-name>. Grant it to any persona that needs to delegate work:
personas: - name: orchestrator capabilities: allow: - persona.send:*Without this capability, the tools are hidden from the agent’s tool list entirely.
Restricting delegation targets
Section titled “Restricting delegation targets”persona.send:* lets a persona delegate to any persona. To limit it, list one persona.send:<persona-name> label per allowed target:
personas: - name: coordinator capabilities: allow: - persona.send:researcher - persona.send:code-reviewercoordinator can now delegate only to researcher and code-reviewer.
persona_sendrejects any other target before anything is queued. The error names the allowed targets.persona_listand the “Available personas” roster in the system prompt show only the allowed targets.- The daemon checks the calling persona’s own capabilities. A delegated persona is limited by its own labels, not by those of its caller.
persona_task_statusandpersona_task_cancelstay available with anypersona.sendlabel.- A wildcard wins over scoped labels. An unscoped
persona.sendbehaves likepersona.send:*. - Names are matched exactly and are case-sensitive. A scoped name that matches no configured persona is logged as a warning at load and never matches.
Sending a task
Section titled “Sending a task”Use the persona_send host tool:
persona_send({ target_persona: "researcher", message: "Find the latest pricing for AWS Lambda in eu-west-1", await_reply: true})| Parameter | Type | Required | Description |
|---|---|---|---|
target_persona | string | Yes | Name of the target persona, exactly as returned by persona_list |
message | string | Yes | Complete, self-contained brief. It is the only thing the target sees |
await_reply | boolean | No | true blocks until the target responds (default: false) |
timeout_ms | number | No | Max ms to wait when await_reply: true; default 300000 (5 minutes), max 1800000 (30 minutes) |
cancel_on_timeout | boolean | No | With await_reply: cancel the delegated task if the wait times out (default: false) |
When await_reply: false (fire-and-forget), the tool returns immediately with the task ID. The target processes the task asynchronously.
When await_reply: true, the call waits up to 5 minutes (configurable with timeout_ms). If the target finishes before the timeout expires, the result is returned inline. If the timeout expires first, a structured timeout response is returned containing the task_id. The delegated task keeps running. Use persona_task_status to retrieve the final result later. With cancel_on_timeout: true, Talon cancels the task instead: a pending task is dropped and an in-flight run is aborted.
The wait includes the time the task spends queued behind other tasks for the same persona. It also counts toward the calling persona’s own queryTimeoutMinutes (default 10). For delegations that can take longer than 5 minutes, raise timeout_ms and the calling persona’s queryTimeoutMinutes together. Or send without await_reply and collect the result with persona_task_status.
Discovering personas
Section titled “Discovering personas”Use persona_list to discover available delegation targets:
persona_list()Returns an array of persona cards:
[ { "name": "researcher", "description": "Research assistant with web search capabilities", "skills": ["web-search", "file-analysis"] }, { "name": "writer", "description": "Content writer for blog posts and documentation", "skills": ["markdown-editor"] }]The calling persona is excluded from the list. With scoped persona.send:<persona-name> labels, the list shows only the allowed targets. skills is the persona’s configured skill list.
description comes from the description: key in the frontmatter of the target’s system.md. Without that key, Talon falls back to the first line of the prompt body. Write the description so a caller can tell when to delegate to this persona:
---description: "Code reviewer: security and performance review of diffs and PRs; returns findings ranked by severity"---Roster in the system prompt
Section titled “Roster in the system prompt”Talon also explains delegation to the calling agent. Every persona that is allowed persona_send gets the persona-delegation instructions in its system prompt, followed by an “Available personas” roster. The roster has one line per other loaded persona that the caller may delegate to, sorted by name. Descriptions are cut to 200 characters and the roster holds at most 30 entries. Talon rebuilds it on hot reload. A persona with no description shows a reminder to add one.
The instructions come from templates/tool-instructions/persona.send.md. See Tool instructions.
Checking task status
Section titled “Checking task status”When await_reply: true times out before the target persona finishes, persona_send returns a structured response containing the task_id. Use persona_task_status to retrieve the result:
persona_task_status({ task_id: "abc123", wait_ms: 60000 // optional: poll for up to 60 s})| Parameter | Type | Required | Description |
|---|---|---|---|
task_id | string | Yes | Task ID from the persona_send timeout response |
wait_ms | number | No | Poll until terminal state or this duration elapses |
Terminal states are completed, failed, and canceled. Requires a persona.send capability.
Canceling a task
Section titled “Canceling a task”Use persona_task_cancel to stop a delegation you no longer need:
persona_task_cancel({ task_id: "abc123", reason: "superseded" // optional})| Parameter | Type | Required | Description |
|---|---|---|---|
task_id | string | Yes | Task ID returned by persona_send |
reason | string | No | Short reason, recorded on the canceled task |
A queued task is dropped. A running task is aborted. The tool returns { task_id, state, canceled }. canceled: false means the task had already finished, and state is its real final state. A persona can only cancel tasks that it submitted itself in its current thread.
From the command line:
npx talonctl a2a cancel 2b004602-b6ac-4dec-bd7b-f88e0565a16a --reason "superseded"a2a cancel asks the running daemon, so an in-flight run is aborted. If the daemon does not answer within --timeout (default 5000 ms), the command cancels the task directly in the database. It needs the full task ID. a2a list shows only the first 8 characters, so take the full ID from the persona_send result or from a2a send.
Task lifecycle
Section titled “Task lifecycle”A2A tasks have their own states in the a2a_tasks table:
| State | Meaning |
|---|---|
submitted | Task accepted, waiting for a free slot on the target persona |
working | Admitted. The agent runner is processing it |
input-required | Reserved. The current implementation never sets it |
completed | Target persona finished and returned a result |
failed | Final failure, with an error code |
canceled | Canceled by the caller, by cancel_on_timeout, by the CLI, or by the task TTL |
Tasks are persisted in SQLite and survive daemon restarts.
Lifecycle rules:
- Terminal states are final.
completed,failed, andcanceledare never overwritten. Talon skips a queue item whose task is already terminal. - Busy personas queue. At most
maxConcurrentPerTargettasks run per target persona. Further tasks staysubmittedand are admitted in submission order. Talon rejects a submission only when the backlog for that persona reachesmaxQueuedPerTarget, or when it would create a delegation cycle. failedmeans final. WithmaxAttemptsabove 1, a task staysworkingacross queue retries. Talon marks itfailedonly on the last attempt. Nothing retries a failed task automatically. The calling agent decides whether to resend.- Stale tasks are reaped. At startup and every 60 seconds, Talon marks tasks whose queue item is gone, completed, or dead-lettered as
failed. It cancels tasks older thantaskTtlMinutes. - Hot reload rebuilds the agent cards, so a persona added by
talonctl reloadis routable immediately. Changes to thea2a:limits need a restart.
Multi-hop prevention
Section titled “Multi-hop prevention”Each A2A task carries a hop counter. When persona A delegates to persona B, the hop count increments. Talon enforces a maximum hop depth to prevent infinite delegation chains.
The default limit is 4 hops, configurable via a2a.maxHops in talond.yaml (bounds: 1–32). When the limit is reached, the task is rejected with a clear error message so the calling persona can handle the failure.
Talon also rejects delegation cycles. A submission fails when the target is already running an ancestor of the new task and would wait on itself.
Configuring A2A limits
Section titled “Configuring A2A limits”The A2A limits live under the top-level a2a: key in talond.yaml. All keys are optional:
a2a: maxHops: 4 maxConcurrentPerTarget: 1 maxQueuedPerTarget: 10 maxAttempts: 1 taskTtlMinutes: 60| Field | Default | Bounds | When to change |
|---|---|---|---|
maxHops | 4 | 1–32 | Increase if you have deep orchestrator chains; decrease to tighten delegation depth. |
maxConcurrentPerTarget | 1 | 1–100 | Tasks that may run at once per target persona. Raise it to allow parallel fan-out to the same persona. |
maxQueuedPerTarget | 10 | 0–1000 | Tasks that may wait per target persona. Submissions beyond it are rejected with a “Max queued” error. |
maxAttempts | 1 | 1–20 | Queue attempts before dead-letter. A higher value re-runs the whole delegated task, including its side effects. |
taskTtlMinutes | 60 | 1–1440 | Non-terminal tasks older than this are canceled. |
CLI commands
Section titled “CLI commands”# List the 20 most recent A2A tasksnpx talonctl a2a listnpx talonctl a2a list --status working --target software-engineer
# Submit a task manually (for testing)npx talonctl a2a send software-engineer "Review the latest PR"
# Cancel a tasknpx talonctl a2a cancel <taskId>Example: orchestrator pattern
Section titled “Example: orchestrator pattern”personas: - name: orchestrator model: claude-sonnet-4-6 systemPromptFile: personas/orchestrator/system.md capabilities: allow: - persona.send:researcher - persona.send:writer - channel.send:my-slack
- name: researcher model: claude-sonnet-4-6 systemPromptFile: personas/researcher/system.md skills: - web-search capabilities: allow: - net.http
- name: writer model: claude-sonnet-4-6 systemPromptFile: personas/writer/system.md capabilities: allow: - channel.send:my-slackThe orchestrator receives user requests, delegates research to researcher (with await_reply: true), then delegates writing to writer. Each persona has only the capabilities it needs.