Skip to main content
POST
/
api
/
agents
/
{agentId}
/
run-sync
cURL
curl --request POST \
  --url https://app.cotool.ai/api/agents/{agentId}/run-sync \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "inputs": {},
  "attachments": [
    {
      "fileId": "<string>",
      "fileName": "<string>",
      "mimeType": "<string>",
      "size": 123,
      "objectPath": "<string>",
      "fileType": "image",
      "previewText": "<string>"
    }
  ]
}'
{
  "finalAssistantMessage": "<string>",
  "allToolCallsMade": [
    {
      "type": "tool-call",
      "toolCallId": "<string>",
      "toolName": "<string>",
      "args": "<any>"
    }
  ],
  "allToolResultsReceived": [
    {
      "type": "tool-result",
      "toolCallId": "<string>",
      "toolName": "<string>",
      "result": "<any>",
      "isError": true
    }
  ],
  "messages": [
    {
      "role": "system",
      "content": "<string>"
    }
  ]
}

Authorizations

Authorization
string
header
required

API Key authentication for programmatic access. Include your API key in the Authorization header as: Bearer your_api_key_here

Path Parameters

agentId
string<uuid>
required

Unique identifier of the agent to execute

Body

application/json

Input values for agent execution based on agent input configuration

inputs
object
required

Input values for agent execution based on agent input configuration. This can be any JSON object and will be stringified as input to the agent.

attachments
object[]

Optional array of file attachments to include with the agent execution

Response

200 - application/json

Successful response

Complete result of synchronous agent execution

finalAssistantMessage
string
required

The final text response from the assistant

allToolCallsMade
object[]
required

All tool calls made during the agent run

allToolResultsReceived
object[]
required

All tool results received during the agent run

messages
object[]
required

Complete message history from the agent run

  • Option 1
  • Option 2
  • Option 3
  • Option 4