Skip to main content
A2ASubmitting tasks
A2A

Submitting tasks

Send a buyer request to a store agent and track the task until it completes, fails, or needs more input.

SendMessage, streaming, task lookup/list/cancel, HTTP+JSON aliases, subscriptions, push configs, and error codes.

Tasks are the durable A2A record Aly stores in Convex. ASendMessage call currently creates a new task, runs one commerce skill, appends the agent response, and returns the final task state. Use contextId to group related task records from one conversation; do not rely on taskId continuation until the route explicitly supports appending to an existing task.

Authenticated task access
SendMessage can run public skills without auth, but task lookup, listing, cancelation, subscriptions, and push-config management require a workspace-scoped OAuth access token or API key. Browser session JWTs are intentionally rejected on authenticated A2A task routes.

Core methods

SendMessage

Create a task from a user message. The request message must include a stable messageId, role, and at least one part. Public JSON uses ProtoJSON camelCase, while snake_case is accepted at the boundary for compatibility.

bash
curl -X POST https://aly.store/api/a2a \  -H "Content-Type: application/json" \  -H "A2A-Version: 1.0" \  -d '{    "jsonrpc": "2.0",    "id": "req_send_1",    "method": "SendMessage",    "params": {      "message": {        "messageId": "msg_1",        "contextId": "ctx_4f...11",        "role": "ROLE_USER",        "parts": [          { "text": "Search for hats on store acme." }        ]      }    }  }'

SendMessage returns result.task. The task contains status, history, artifacts, and metadata.

Structured skill payloads

For deterministic calls, send a structured data part. The intent parser reads fields such as skill, site_slug, cart_token, product_id, quantity, and confirmation_token.

json
{  "jsonrpc": "2.0",  "id": "req_send_2",  "method": "SendMessage",  "params": {    "message": {      "messageId": "msg_2",      "contextId": "ctx_4f...11",      "role": "ROLE_USER",      "parts": [        {          "mediaType": "application/json",          "data": {            "skill": "cart-management",            "action": "create",            "site_slug": "acme"          }        }      ]    }  }}

cart-management and checkout requireAuthorization: Bearer ... with write:orders.

GetTask

bash
curl -X POST https://aly.store/api/a2a \  -H "Content-Type: application/json" \  -H "Authorization: Bearer aly_oauth_..." \  -d '{    "jsonrpc": "2.0",    "id": "req_get_1",    "method": "GetTask",    "params": { "taskId": "task_8e3...77c" }  }'

Returns the task directly in result. A missing or cross-workspace task returns JSON-RPC error -32001. The current route accepts canonical id as well astaskId / task_id, but it does not implement the A2A historyLength request parameter yet.

CancelTask

bash
curl -X POST https://aly.store/api/a2a \  -H "Content-Type: application/json" \  -H "Authorization: Bearer aly_oauth_..." \  -d '{    "jsonrpc": "2.0",    "id": "req_cancel_1",    "method": "CancelTask",    "params": { "taskId": "task_8e3...77c" }  }'

A cancelable task moves to TASK_STATE_CANCELED. Terminal tasks cannot be canceled and return -32002.

ListTasks

bash
curl -X POST https://aly.store/api/a2a \  -H "Content-Type: application/json" \  -H "Authorization: Bearer aly_oauth_..." \  -d '{    "jsonrpc": "2.0",    "id": "req_list_1",    "method": "ListTasks",    "params": { "contextId": "ctx_4f...11", "limit": 20 }  }'

The result is { tasks, nextPageToken, pageSize, totalSize }. The HTTP task-list route also accepts pageSize /pageToken and the older limit /cursor query names. Current filtering is limited tocontextId; A2A status,statusTimestampAfter, historyLength, andincludeArtifacts list parameters are not wired yet.

History returned today
GetTask and ListTasksreturn the task history stored on the Convex task record, bounded by Aly's internal task history cap. They do not currently trim per request.

Streaming

POST /api/a2a/streaming is the direct SSE endpoint. It expects a params envelope rather than a full JSON-RPC request. The JSON-RPC route also supports SendStreamingMessage.

bash
curl -N -X POST https://aly.store/api/a2a/streaming \  -H "Content-Type: application/json" \  -d '{    "params": {      "message": {        "messageId": "msg_stream_1",        "contextId": "ctx_4f...11",        "role": "ROLE_USER",        "parts": [{ "text": "Show products on store acme." }]      }    }  }'
text
data: {"statusUpdate":{"taskId":"task_123","contextId":"ctx_4f...11","status":{"state":"TASK_STATE_WORKING","timestamp":"..."}}} data: {"artifactUpdate":{"taskId":"task_123","contextId":"ctx_4f...11","artifact":{"artifactId":"search_results","name":"search_results","parts":[...]}, "lastChunk": true}} data: {"statusUpdate":{"taskId":"task_123","contextId":"ctx_4f...11","status":{"state":"TASK_STATE_COMPLETED","message":{...},"timestamp":"..."}}}

HTTP+JSON routes

RouteBehavior
POST /api/a2a/message:sendAccepts the same { message, configuration } params body as SendMessage and returns { task }.
POST /api/a2a/message:streamAccepts the same params body and proxies to the SSE streaming handler.
GET /api/a2a/tasksLists workspace tasks with optional contextId, pageSize, and pageToken.
GET /api/a2a/tasks/{taskId}Fetches one task.
POST /api/a2a/tasks/{taskId}/cancelCancels one task. /tasks/{taskId}:cancel is also wired.
GET or POST /api/a2a/tasks/{taskId}/subscribeSubscribes to a non-terminal task over SSE. /tasks/{taskId}:subscribe is also wired.
GET or POST /api/a2a/tasks/{taskId}/push-configsLists or registers push notification configs. The camel path pushNotificationConfigs is also wired.
GET or DELETE /api/a2a/tasks/{taskId}/push-configs/{configId}Reads or deletes one push config by id or URL.

Task context

Use one contextId for a conversation so later listings and operator tools can group related tasks. Aly does not currently dedupe repeated SendMessage calls by message hash, so callers that need retry safety should provide their own idempotency guard.

Push configs

Push configs are stored on the task record. Up to 20 configs can be attached. Delivery URLs must be HTTP(S), with HTTPS required outside localhost development. Terminal tasks cannot accept new push configs, and terminal transitions clear persisted configs.

Errors

JSON-RPC codeMeaning
-32700Parse error.
-32600Invalid JSON-RPC envelope.
-32601Unknown method.
-32602Invalid params.
-32603Internal route or skill error.
-32000Authentication required.
-32001Task or push config not found.
-32002Task not found or cannot be canceled.
-32003Forbidden or push config could not be registered.
-32004Unsupported operation, such as subscribing to a terminal task.
Updated

Was this page helpful?