Endpoint
Request
Request body
| Field | Type | Required | Description |
|---|---|---|---|
message | string | yes | The message to send to the agent |
context_id | string | no | IM channel ID for multi-turn conversations. Omit to start a new conversation. |
timeout_ms | integer | no | End-to-end timeout in milliseconds |
Blocking response
By default, the endpoint blocks until the agent replies:| Field | Type | Description |
|---|---|---|
message | string | Status indicator ("ok" on success) |
text | string | The agent’s reply text |
context_id | string | Channel ID for continuing the conversation |
is_error | boolean | Whether the agent returned an error |
Streaming response
SetAccept: text/event-stream to receive streaming deltas:
Multi-turn conversations
Usecontext_id to continue a conversation across multiple invocations:
When to use REST invoke vs A2A JSON-RPC
| Feature | REST invoke | A2A JSON-RPC |
|---|---|---|
| Simple request/reply | Yes | Yes |
| Task lifecycle (get, cancel, list) | No | Yes |
| Agent card discovery | No | Yes |
| Multi-turn context | Yes (context_id) | Yes (via task) |
| Streaming | Yes (SSE) | Yes (SSE) |
| Complexity | Low | Medium |
Shared transport
Under the hood, REST invoke uses the samepkg/chatinvoke transport as
MCP tools/call. Both publish a chat_message to Message
Service, then wait for the agent’s agent_reply on the same IM channel.
Authentication
Same as A2A JSON-RPC:| Method | Header |
|---|---|
| Agent API Key | X-Agent-API-Key: bak_... or Authorization: Bearer bak_... |
| User API Key | Authorization: Bearer oag_... |
| JWT | Authorization: Bearer eyJ... |