Agent-to-Agent (A2A) API
Submit tasks to CodeSpar agents from external systems using the A2A protocol.
Agent-to-Agent (A2A) API
CodeSpar implements Google's A2A protocol for agent-to-agent communication. External agents and automation tools can discover CodeSpar agents, submit tasks, and track their lifecycle through a standard interface.
Agent Discovery
Well-Known Agent Card
Returns the primary agent card following the A2A discovery spec.
Request
Response
List All Agent Cards
Retrieve metadata for all registered agent types.
Request
Response
Get Single Agent Card
Retrieve the card for a specific agent type.
Request
Response
Task Submission
Submit a task to a CodeSpar agent. The system routes the task to the appropriate agent based on the skill field.
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
id | string | No | Client-provided task ID (UUID v7 generated if omitted) |
skill | string | Yes | Skill to invoke (see Skills Reference below) |
input | object | Yes | Task input payload |
input.text | string | Yes | Natural language instruction or query |
input.attachments | object[] | No | File references or inline content |
metadata | object | No | Arbitrary key-value pairs passed to the agent |
Request
Response
Response Schema
| Field | Type | Description |
|---|---|---|
id | string | Unique task identifier |
status | string | Initial status (always submitted) |
skill | string | Skill that was matched |
agentType | string | Agent type handling the task |
createdAt | string | ISO 8601 timestamp |
Task Management
List Tasks
Retrieve submitted tasks with optional filtering.
Query Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
limit | number | 20 | Max results (1-100) |
offset | number | 0 | Pagination offset |
project | string | — | Filter by project ID |
status | string | — | Filter by status |
Request
Response
Get Task Status
Retrieve the current status and output of a specific task.
Request
Response
Cancel a Task
Cancel a task that is submitted or working.
Request
Response
Error Response
Task Lifecycle
Tasks follow a linear lifecycle:
| Status | Description |
|---|---|
submitted | Task received and queued |
working | Agent is actively processing |
completed | Task finished successfully with output |
failed | Task failed (error details in output) |
cancelled | Task cancelled by client or timeout |
Skills Reference
All available skills grouped by agent type.
| Agent Type | Skill | Description |
|---|---|---|
| project | build-status | Check CI/CD build status |
| project | diff-summary | Summarize branch or PR diff |
| project | instruct-task | Delegate a coding task to Task Agent |
| project | deploy-trigger | Initiate a deployment |
| project | log-tail | Retrieve recent activity logs |
| task | code-edit | Edit existing code files |
| task | code-generate | Generate new code from spec |
| task | test-write | Write or update tests |
| task | refactor | Refactor code for quality |
| review | pr-review | Full pull request review |
| review | risk-classify | Classify PR risk level |
| review | review-summary | Concise review summary |
| deploy | deploy-staging | Deploy to staging environment |
| deploy | deploy-production | Deploy to production (requires approval) |
| deploy | rollback | Rollback last deployment |
| deploy | health-check | Post-deploy health verification |
| incident | investigate | Investigate production error |
| incident | correlate | Correlate error with recent changes |
| incident | hotfix | Propose a hotfix |
| coordinator | cascade-deploy | Orchestrate multi-project deploy |
| coordinator | resource-lock | Acquire/release shared resource locks |
| coordinator | cross-project-query | Query across multiple projects |
Next Steps
- Agent API -- Manage agent lifecycle
- Webhooks API -- Incoming event webhooks
- Integrations API -- Third-party service integrations