Submit a tool result
POST/v2/agents/{agentId}/chat/tool-results
Return the outcome of a client action to an agent after it asked your app to run a tool, so the agent can continue its answer.
Working draft. These docs are illustrative: names, endpoints and examples describe the intended behaviour and can change before launch.
Sends the result of a client action back to the agent. Call it after a chat response or a tool.call event asked your app to run a tool, such as an order lookup. The agent then continues and returns its answer.
Request
POST /v2/agents/{agentId}/chat/tool-results
Path parameters:
| Name | Type | Required | Description |
|---|---|---|---|
agentId |
string | Yes | The ID of the agent, starting with agt_. |
Body fields:
| Name | Type | Required | Description |
|---|---|---|---|
conversationId |
string | Yes | The conversation that holds the tool call, starting with conv_. |
toolCallId |
string | Yes | The toolCallId from the tool call you are answering. |
result |
object | One of result or error |
The outcome of the action, as any JSON object. |
error |
string | One of result or error |
A short message when your app could not run the action. |
stream |
boolean | No | true returns server-sent events instead of JSON. Defaults to false. |
Send exactly one of result and error. Every tool call needs an answer, because the conversation waits for it. The whole flow is explained in Client actions.
Example request
curl -X POST https://api.askocto.co/v2/agents/agt_8f3k2m/chat/tool-results \
-H "Authorization: Bearer $OCTO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"conversationId": "conv_5n2p8w",
"toolCallId": "call_6t2x9a",
"result": { "status": "shipped", "expectedDelivery": "2026-03-18" }
}'
const response = await fetch(
"https://api.askocto.co/v2/agents/agt_8f3k2m/chat/tool-results",
{
method: "POST",
headers: {
Authorization: `Bearer ${process.env.OCTO_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
conversationId: "conv_5n2p8w",
toolCallId: "call_6t2x9a",
result: { status: "shipped", expectedDelivery: "2026-03-18" },
}),
},
)
const reply = await response.json()
console.log(reply.message.content)
Example response
A successful call returns 200 OK with the next assistant message, in the shape of a chat response.
{
"conversationId": "conv_5n2p8w",
"message": {
"id": "msg_3j5m1q",
"role": "assistant",
"content": "Your order 1042 has shipped and should arrive on March 18.",
"sources": []
},
"usage": { "credits": 1 }
}
Response fields
The response matches Chat with an agent. If the agent needs another action, toolCalls is present and message.content is empty, so repeat the call until toolCalls is missing or empty.
Errors
| Status | Code | When |
|---|---|---|
| 400 | invalid_request |
A required field is missing, or you sent both result and error, or neither. |
| 401 | unauthorized |
The API key is missing, malformed or deleted. |
| 404 | not_found |
The agent, the conversation or the tool call does not exist. |
| 409 | conflict |
The tool call was already answered. |
| 429 | rate_limited |
Too many requests. Wait for the number of seconds in the Retry-After header. |