JavaScript
import Cerca from '@cerca-dev/sdk';
const client = new Cerca({
apiKey: process.env['CERCA_API_KEY'], // This is the default and can be omitted
});
const turn = await client.threads.startTurn('agent_abc123', 'thread_abc123', {
message: 'message',
});
console.log(turn.id);import os
from cerca import Cerca
client = Cerca(
api_key=os.environ.get("CERCA_API_KEY"), # This is the default and can be omitted
)
turn = client.threads.start_turn(
agent_id="agent_abc123",
thread_id="thread_abc123",
message="message",
)
print(turn.id)package main
import (
"context"
"fmt"
"github.com/matrices/cerca-go"
"github.com/matrices/cerca-go/option"
)
func main() {
client := cercago.NewClient(
option.WithAPIKey("My API Key"),
)
turn, err := client.Threads.StartTurn(
context.TODO(),
"agent_abc123",
"thread_abc123",
cercago.ThreadStartTurnParams{
Message: cercago.F("message"),
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", turn.ID)
}
require "cerca"
cerca = Cerca::Client.new(api_key: "My API Key")
turn = cerca.threads.start_turn("agent_abc123", "thread_abc123", message: "message")
puts(turn)cerca threads start-turn \
--api-key 'My API Key' \
--agent-id agent_abc123 \
--thread-id thread_abc123 \
--message messagecurl --request POST \
--url https://api.cerca.dev/agents/{agentId}/threads/{threadId}/turns \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"message": "<string>",
"model": "<string>",
"tools": [
"sandbox.*"
]
}
'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.cerca.dev/agents/{agentId}/threads/{threadId}/turns",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'message' => '<string>',
'model' => '<string>',
'tools' => [
'sandbox.*'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.post("https://api.cerca.dev/agents/{agentId}/threads/{threadId}/turns")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"message\": \"<string>\",\n \"model\": \"<string>\",\n \"tools\": [\n \"sandbox.*\"\n ]\n}")
.asString();{
"completedAt": "<string>",
"endMessageSeq": 123,
"error": "<string>",
"id": "<string>",
"result": "<string>",
"seq": 123,
"startMessageSeq": 123,
"startedAt": "<string>",
"status": "running",
"threadId": "<string>",
"tokenUsage": {
"inputTokens": 123,
"outputTokens": 123
},
"message": "<string>"
}{
"error": "<string>",
"code": "MONTHLY_TOKEN_BUDGET_EXCEEDED"
}{
"error": "<string>",
"code": "MONTHLY_TOKEN_BUDGET_EXCEEDED"
}{
"error": "<string>",
"code": "MONTHLY_TOKEN_BUDGET_EXCEEDED"
}{
"error": "<string>",
"code": "MONTHLY_TOKEN_BUDGET_EXCEEDED"
}{
"error": "<string>",
"code": "MONTHLY_TOKEN_BUDGET_EXCEEDED"
}{
"error": "<string>",
"code": "MONTHLY_TOKEN_BUDGET_EXCEEDED"
}{
"error": "<string>",
"code": "MONTHLY_TOKEN_BUDGET_EXCEEDED"
}{
"error": "<string>",
"code": "MONTHLY_TOKEN_BUDGET_EXCEEDED"
}{
"error": "<string>",
"code": "MONTHLY_TOKEN_BUDGET_EXCEEDED"
}Threads
Create turn
POST
/
agents
/
{agentId}
/
threads
/
{threadId}
/
turns
JavaScript
import Cerca from '@cerca-dev/sdk';
const client = new Cerca({
apiKey: process.env['CERCA_API_KEY'], // This is the default and can be omitted
});
const turn = await client.threads.startTurn('agent_abc123', 'thread_abc123', {
message: 'message',
});
console.log(turn.id);import os
from cerca import Cerca
client = Cerca(
api_key=os.environ.get("CERCA_API_KEY"), # This is the default and can be omitted
)
turn = client.threads.start_turn(
agent_id="agent_abc123",
thread_id="thread_abc123",
message="message",
)
print(turn.id)package main
import (
"context"
"fmt"
"github.com/matrices/cerca-go"
"github.com/matrices/cerca-go/option"
)
func main() {
client := cercago.NewClient(
option.WithAPIKey("My API Key"),
)
turn, err := client.Threads.StartTurn(
context.TODO(),
"agent_abc123",
"thread_abc123",
cercago.ThreadStartTurnParams{
Message: cercago.F("message"),
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", turn.ID)
}
require "cerca"
cerca = Cerca::Client.new(api_key: "My API Key")
turn = cerca.threads.start_turn("agent_abc123", "thread_abc123", message: "message")
puts(turn)cerca threads start-turn \
--api-key 'My API Key' \
--agent-id agent_abc123 \
--thread-id thread_abc123 \
--message messagecurl --request POST \
--url https://api.cerca.dev/agents/{agentId}/threads/{threadId}/turns \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"message": "<string>",
"model": "<string>",
"tools": [
"sandbox.*"
]
}
'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.cerca.dev/agents/{agentId}/threads/{threadId}/turns",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'message' => '<string>',
'model' => '<string>',
'tools' => [
'sandbox.*'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.post("https://api.cerca.dev/agents/{agentId}/threads/{threadId}/turns")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"message\": \"<string>\",\n \"model\": \"<string>\",\n \"tools\": [\n \"sandbox.*\"\n ]\n}")
.asString();{
"completedAt": "<string>",
"endMessageSeq": 123,
"error": "<string>",
"id": "<string>",
"result": "<string>",
"seq": 123,
"startMessageSeq": 123,
"startedAt": "<string>",
"status": "running",
"threadId": "<string>",
"tokenUsage": {
"inputTokens": 123,
"outputTokens": 123
},
"message": "<string>"
}{
"error": "<string>",
"code": "MONTHLY_TOKEN_BUDGET_EXCEEDED"
}{
"error": "<string>",
"code": "MONTHLY_TOKEN_BUDGET_EXCEEDED"
}{
"error": "<string>",
"code": "MONTHLY_TOKEN_BUDGET_EXCEEDED"
}{
"error": "<string>",
"code": "MONTHLY_TOKEN_BUDGET_EXCEEDED"
}{
"error": "<string>",
"code": "MONTHLY_TOKEN_BUDGET_EXCEEDED"
}{
"error": "<string>",
"code": "MONTHLY_TOKEN_BUDGET_EXCEEDED"
}{
"error": "<string>",
"code": "MONTHLY_TOKEN_BUDGET_EXCEEDED"
}{
"error": "<string>",
"code": "MONTHLY_TOKEN_BUDGET_EXCEEDED"
}{
"error": "<string>",
"code": "MONTHLY_TOKEN_BUDGET_EXCEEDED"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Minimum string length:
1Example:
"agent_abc123"
Minimum string length:
1Example:
"thread_abc123"
Body
application/json
Per-turn tool subset. Omit to inherit the thread's current tools; pass [] to run this turn with no configurable tools. Provided entries can only narrow the agent/thread effective tools.
Configurable runtime tool name, configurable namespace wildcard such as sandbox., or external namespace wildcard such as google.. At thread and turn scope, entries can only narrow the agent's effective tools.
Minimum string length:
1Response
Thread turn started.
Available options:
running, completed, failed Show child attributes
Show child attributes