Skip to content
QwryAI
Documentation
Pages

Endpoints

Submit a tool result

Send the result of a client action back to the agent so it can finish its answer

When the agent calls a client action, your app runs it, not QwryAI. The answer stops with finishReason: "tool-calls" and a tool-call part holding a toolCallId. Run the action, send its result here with that toolCallId, then call Chat with an agent again with the same conversationId so the agent can use the result.

POSThttps://api.qwryai.com/api/v2/agents/{agentId}/conversations/{conversationId}/tool-result

Authentication

Send your API key as Authorization: Bearer <api-key>. The key needs Chat with agents. See Authentication.

Path parameters

NameTypeRequiredDescription
agentIdstringYesThe agent's id, from list_agents.
conversationIdstringYesThe conversation the action was called in.

Body parameters

NameTypeRequiredDescription
toolCallIdstringYesThe toolCallId from the tool-call part, or from the stream's tool-input-start event.
outputany JSONNoWhat the action returned: an object, array, string, number or boolean. Up to 256 KB. Leave it out to send null.

Any other field is refused with VALIDATION_INVALID_BODY.

Request example

Bash
curl -X POST 'https://api.qwryai.com/api/v2/agents/YOUR_AGENT_ID/conversations/fd5ae9e1-9b30-4503-b346-ccd4d7ef16a3/tool-result' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
    "toolCallId": "a7c4e9d2-3b1f-4a68-8e5c-0f9d2b6a1c37",
    "output": { "items": 2, "total": "84.00", "currency": "NZD" }
  }'

Response

JSON
{
  "data": {
    "success": true
  }
}

The result is stored, and the agent uses it on your next chat request for this conversation. If the agent called several client actions in one answer, submit a result for each before you continue.

Errors

HTTP statusCodeWhen
400VALIDATION_INVALID_BODYNo toolCallId, an unknown field, or an output over 256 KB.
401AUTH_MISSING_API_KEY / AUTH_INVALID_API_KEYNo key, or an unknown, deleted or expired key.
403SUBSCRIPTION_API_RESTRICTED_PLANThe workspace's plan doesn't include API access.
403ACCESS_COUNTRY_BLOCKEDThe request comes from a country the agent blocks in Guardrails.
403CHAT_CONVERSATION_MISMATCHThe conversation doesn't exist or belongs to another agent.
404AGENT_NOT_FOUNDNo agent with that id in your workspace.
404RESOURCE_TOOL_CALL_NOT_FOUNDNo client action is waiting for this toolCallId in this conversation: it expired, or its result was already submitted.
409CHAT_CONVERSATION_NOT_ONGOINGThe conversation ended, or a teammate took it over.
429RATE_LIMIT_TOO_MANY_REQUESTSToo many requests. Wait for Retry-After seconds.
500INTERNAL_SERVER_ERRORSomething failed on our side.

See Error Handling for every code.

Explore the documentation