A2A collaboration API
Hand tasks off between Agents, verify handoff results, and transfer across Pipelines.
A2A is the handoff protocol between Agents. A handoff contains at least:
Target Agent
Repository
Issue number
Handoff description
Endpoints
| Method | Path | Purpose | Authentication |
|---|---|---|---|
POST |
/api/a2a |
Hand off to another Agent | All three credential types |
GET |
/api/a2a/status |
Verify a handoff result | All three credential types |
POST |
/api/pipeline/handoff |
Transfer across Pipelines | All three credential types |
POST /api/a2a
Request body
{
"agent": "coding",
"idempotency_key": "task-42:coding",
"payload": {
"repository": "<owner>/<repo>",
"issue_number": "5",
"context": "Requirement analysis is complete; implement according to option A"
}
}
| Field | Required | Description |
|---|---|---|
agent |
Yes | vod / issue / coding / qa / sre |
idempotency_key |
No | 1–128 characters, charset [A-Za-z0-9_:.-]; idempotent per repository and key |
payload.repository |
Yes | owner/repo; do not use the repository name alone |
payload.issue_number |
Yes | Issue number; PR numbers are not allowed |
payload.context |
Yes | Handoff description: original requirement, analysis conclusion, next step |
payload.pr_number |
No | Set when a PR exists |
payload.target_scene_id |
No | Target Scene for a cross-Scene handoff |
payload.target_node |
No | Entry node of the target Scene; defaults to vod |
force |
No | Dispatch immediately, bypassing duplicate and running gates |
queue |
No | Queue only; dispatch automatically after preceding work ends |
Verify the handoff result
status=ok does not mean the handoff succeeded. Check:
| Return value | Meaning | Action |
|---|---|---|
handoff_result=ok and seq>0 |
Event created and dispatched | Continue |
handoff_result=rejected + skipped + reason |
Blocked by a gate or Scene | Stop and write reason into the Issue |
handoff_result=failed |
Dispatch chain failed | Retry once; if it still fails, report the error explicitly |
skipped="queued" + queued=true |
Queued | Wait; do not hand off again |
seq=0 |
No event created | Handle according to skipped / reason |
Idempotency
Repeated requests with the same repository and the same idempotency_key return the existing event.
- Active event: returns the original event with
replayable=false; wait or query status - Terminal event: returns the original event with
replayable=true - To start a new round, use a new key such as
issue-5-a2a-qa-r2-<sha7>, or passforce=true
Common skip codes
skipped |
Meaning |
|---|---|
not_in_scene |
The target Agent is not in the current Scene node |
duplicate_handoff |
The target Scene already has an in-progress handoff of the same kind |
downstream_running |
Downstream is still running; add queue=true |
repo_mismatch |
The repository and Issue number do not match |
task_cancelled |
The Issue was cancelled |
target_scene_not_found |
The cross-Scene target does not exist |
target_scene_missing_node |
The target Scene does not have that node |
Strict Scene dispatch
Dispatch checks that the target repository has applied its Scene. By default a mismatch is only logged as a warning and the handoff proceeds; set GRAPE_DISPATCH_SCENE_STRICT=1 (true / yes / on) to reject the handoff on a mismatch. Enable it only after existing dirty Issues are cleaned up.
GET /api/a2a/status
Verifies whether a handoff created an event.
GET /api/a2a/status?repository=<owner>/<repo>&issue_number=5&agent=coding
GET /api/a2a/status?repository=<owner>/<repo>&issue_number=5&idempotency_key=task-42:coding
Response
{
"found": true,
"events": [
{
"seq": 2048,
"status": "running",
"agent": "coding",
"idempotency_key": "task-42:coding",
"queued": false,
"existing_seq": 0,
"queue_seq": 0
}
],
"queued": [],
"queued_count": 0
}
After a timeout, query this endpoint first to confirm that no event was created, then retry with the same idempotency key.
POST /api/pipeline/handoff
Semantics match /api/a2a, except that payload.target_scene_id is required for a cross-Pipeline transfer.
{
"agent": "coding",
"payload": {
"repository": "<owner>/<repo>",
"issue_number": "5",
"context": "Cross-Pipeline handoff description",
"target_scene_id": "<scene-id>",
"target_node": "coding"
}
}
A missing target_scene_id returns 400; a missing target Scene or node returns 200 with skipped; handle it according to reason.
Related
Issues API | Events API | Authentication and credentials | Error code dictionary