cURL
curl -X POST "https://app.cotool.ai/api/agents/:agentId/run-sync" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"inputs":null,"attachments":[{"fileId":"string","fileName":"string","size":0,"fileType":"image","previewText":"string"}]}'import requests
url = "https://app.cotool.ai/api/agents/{agentId}/run-sync"
payload = {
"inputs": {},
"attachments": [
{
"fileId": "<string>",
"fileName": "<string>",
"size": 123,
"previewText": "<string>"
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
inputs: {},
attachments: [{fileId: '<string>', fileName: '<string>', size: 123, previewText: '<string>'}]
})
};
fetch('https://app.cotool.ai/api/agents/{agentId}/run-sync', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));HttpResponse<String> response = Unirest.post("https://app.cotool.ai/api/agents/{agentId}/run-sync")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"inputs\": {},\n \"attachments\": [\n {\n \"fileId\": \"<string>\",\n \"fileName\": \"<string>\",\n \"size\": 123,\n \"previewText\": \"<string>\"\n }\n ]\n}")
.asString();package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.cotool.ai/api/agents/{agentId}/run-sync"
payload := strings.NewReader("{\n \"inputs\": {},\n \"attachments\": [\n {\n \"fileId\": \"<string>\",\n \"fileName\": \"<string>\",\n \"size\": 123,\n \"previewText\": \"<string>\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"finalAssistantMessage": "<string>",
"allToolCallsMade": [
{
"type": "tool-call",
"toolCallId": "<string>",
"toolName": "<string>",
"args": "<unknown>"
}
],
"allToolResultsReceived": [
{
"type": "tool-result",
"toolCallId": "<string>",
"toolName": "<string>",
"result": "<unknown>",
"isError": true
}
],
"messages": [
{
"role": "system",
"content": "<string>"
}
],
"structuredOutputResult": "<string>"
}{
"code": "run_still_running",
"runId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"statusPath": "<string>",
"resultPath": "<string>"
}{
"error": "<string>",
"issues": [
{}
]
}{
"error": "<string>",
"code": "<string>",
"details": {}
}{
"error": "<string>",
"missingPerms": [
"<string>"
]
}{
"error": "<string>",
"code": "<string>",
"details": {}
}Agents
Run agent synchronously
Execute an agent run in a blocking manner and return the complete result once finished. A run still going after 8 minutes keeps running, and the request returns 202 Accepted with code run_still_running, the runId, and a Location header pointing at /api/agents/:agentId/run-async/:runId/status; poll it (after Retry-After seconds) and read /api/agents/:agentId/run-async/:runId/result once it is done. Use /api/agents/:agentId/run-async for runs that can take longer.
POST
/
api
/
agents
/
{agentId}
/
run-sync
cURL
curl -X POST "https://app.cotool.ai/api/agents/:agentId/run-sync" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"inputs":null,"attachments":[{"fileId":"string","fileName":"string","size":0,"fileType":"image","previewText":"string"}]}'import requests
url = "https://app.cotool.ai/api/agents/{agentId}/run-sync"
payload = {
"inputs": {},
"attachments": [
{
"fileId": "<string>",
"fileName": "<string>",
"size": 123,
"previewText": "<string>"
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
inputs: {},
attachments: [{fileId: '<string>', fileName: '<string>', size: 123, previewText: '<string>'}]
})
};
fetch('https://app.cotool.ai/api/agents/{agentId}/run-sync', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));HttpResponse<String> response = Unirest.post("https://app.cotool.ai/api/agents/{agentId}/run-sync")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"inputs\": {},\n \"attachments\": [\n {\n \"fileId\": \"<string>\",\n \"fileName\": \"<string>\",\n \"size\": 123,\n \"previewText\": \"<string>\"\n }\n ]\n}")
.asString();package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.cotool.ai/api/agents/{agentId}/run-sync"
payload := strings.NewReader("{\n \"inputs\": {},\n \"attachments\": [\n {\n \"fileId\": \"<string>\",\n \"fileName\": \"<string>\",\n \"size\": 123,\n \"previewText\": \"<string>\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"finalAssistantMessage": "<string>",
"allToolCallsMade": [
{
"type": "tool-call",
"toolCallId": "<string>",
"toolName": "<string>",
"args": "<unknown>"
}
],
"allToolResultsReceived": [
{
"type": "tool-result",
"toolCallId": "<string>",
"toolName": "<string>",
"result": "<unknown>",
"isError": true
}
],
"messages": [
{
"role": "system",
"content": "<string>"
}
],
"structuredOutputResult": "<string>"
}{
"code": "run_still_running",
"runId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"statusPath": "<string>",
"resultPath": "<string>"
}{
"error": "<string>",
"issues": [
{}
]
}{
"error": "<string>",
"code": "<string>",
"details": {}
}{
"error": "<string>",
"missingPerms": [
"<string>"
]
}{
"error": "<string>",
"code": "<string>",
"details": {}
}Authorizations
Body
application/json
Input values for agent execution, keyed by name and sent to the agent as its first message
Response
Successful response
- Option 1
- Option 2
The complete result, or with 202 Accepted, where to find the result of a run that is still going
Was this page helpful?
⌘I