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 thread = await client.threads.create('agent_abc123');
console.log(thread.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
)
thread = client.threads.create(
agent_id="agent_abc123",
)
print(thread.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"),
)
thread, err := client.Threads.New(
context.TODO(),
"agent_abc123",
cercago.ThreadNewParams{},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", thread.ID)
}
require "cerca"
cerca = Cerca::Client.new(api_key: "My API Key")
thread = cerca.threads.create("agent_abc123")
puts(thread)cerca threads create \
--api-key 'My API Key' \
--agent-id agent_abc123curl --request POST \
--url https://api.cerca.dev/agents/{agentId}/threads \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"instructions": "<string>",
"model": "<string>",
"systemPrompt": "<string>",
"tools": [
"sandbox.*"
],
"message": "<string>"
}
'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.cerca.dev/agents/{agentId}/threads",
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([
'instructions' => '<string>',
'model' => '<string>',
'systemPrompt' => '<string>',
'tools' => [
'sandbox.*'
],
'message' => '<string>'
]),
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")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"instructions\": \"<string>\",\n \"model\": \"<string>\",\n \"systemPrompt\": \"<string>\",\n \"tools\": [\n \"sandbox.*\"\n ],\n \"message\": \"<string>\"\n}")
.asString();{
"agentId": "<string>",
"completedAt": "<string>",
"createdAt": "<string>",
"depth": 123,
"error": "<string>",
"id": "<string>",
"instructions": "<string>",
"model": "<string>",
"parentThreadId": "<string>",
"result": "<string>",
"scheduleId": "<string>",
"scheduleSeq": 123,
"status": "idle",
"updatedAt": "<string>",
"message": "<string>",
"compiledContext": {
"enabledTools": [
"get_time"
],
"systemPrompt": "<string>",
"turnId": "<string>"
},
"compactionSummary": "<string>",
"compactionThroughSeq": 123,
"composedSystemPrompt": "<string>",
"contextWindow": {
"compacted": true,
"compactionThroughSeq": 123,
"contextWindowTokens": 123,
"estimationMethod": "heuristic_request_v1",
"llmEstimatedTokens": 123,
"model": "<string>",
"rawEstimatedTokens": 123
},
"hasMoreMessages": true,
"lastTurnStatus": "completed",
"messageCursor": 123,
"messages": [
{
"content": [
{
"text": "Hello",
"type": "text"
}
],
"createdAt": "<string>",
"role": "user",
"seq": 123
}
],
"subThreads": [
{
"completedAt": "<string>",
"createdAt": "<string>",
"id": "<string>",
"messageCount": 123,
"model": "<string>",
"parentThreadId": "<string>",
"result": "<string>",
"scheduleId": "<string>",
"scheduleSeq": 123,
"state": "pending",
"stepCount": 123,
"toolUseId": "<string>"
}
],
"tools": [
"get_time"
],
"turns": [
{
"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>"
}
],
"externalToolNamespaces": "all",
"activeTurnModel": "<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"
}Create thread
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 thread = await client.threads.create('agent_abc123');
console.log(thread.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
)
thread = client.threads.create(
agent_id="agent_abc123",
)
print(thread.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"),
)
thread, err := client.Threads.New(
context.TODO(),
"agent_abc123",
cercago.ThreadNewParams{},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", thread.ID)
}
require "cerca"
cerca = Cerca::Client.new(api_key: "My API Key")
thread = cerca.threads.create("agent_abc123")
puts(thread)cerca threads create \
--api-key 'My API Key' \
--agent-id agent_abc123curl --request POST \
--url https://api.cerca.dev/agents/{agentId}/threads \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"instructions": "<string>",
"model": "<string>",
"systemPrompt": "<string>",
"tools": [
"sandbox.*"
],
"message": "<string>"
}
'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.cerca.dev/agents/{agentId}/threads",
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([
'instructions' => '<string>',
'model' => '<string>',
'systemPrompt' => '<string>',
'tools' => [
'sandbox.*'
],
'message' => '<string>'
]),
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")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"instructions\": \"<string>\",\n \"model\": \"<string>\",\n \"systemPrompt\": \"<string>\",\n \"tools\": [\n \"sandbox.*\"\n ],\n \"message\": \"<string>\"\n}")
.asString();{
"agentId": "<string>",
"completedAt": "<string>",
"createdAt": "<string>",
"depth": 123,
"error": "<string>",
"id": "<string>",
"instructions": "<string>",
"model": "<string>",
"parentThreadId": "<string>",
"result": "<string>",
"scheduleId": "<string>",
"scheduleSeq": 123,
"status": "idle",
"updatedAt": "<string>",
"message": "<string>",
"compiledContext": {
"enabledTools": [
"get_time"
],
"systemPrompt": "<string>",
"turnId": "<string>"
},
"compactionSummary": "<string>",
"compactionThroughSeq": 123,
"composedSystemPrompt": "<string>",
"contextWindow": {
"compacted": true,
"compactionThroughSeq": 123,
"contextWindowTokens": 123,
"estimationMethod": "heuristic_request_v1",
"llmEstimatedTokens": 123,
"model": "<string>",
"rawEstimatedTokens": 123
},
"hasMoreMessages": true,
"lastTurnStatus": "completed",
"messageCursor": 123,
"messages": [
{
"content": [
{
"text": "Hello",
"type": "text"
}
],
"createdAt": "<string>",
"role": "user",
"seq": 123
}
],
"subThreads": [
{
"completedAt": "<string>",
"createdAt": "<string>",
"id": "<string>",
"messageCount": 123,
"model": "<string>",
"parentThreadId": "<string>",
"result": "<string>",
"scheduleId": "<string>",
"scheduleSeq": 123,
"state": "pending",
"stepCount": 123,
"toolUseId": "<string>"
}
],
"tools": [
"get_time"
],
"turns": [
{
"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>"
}
],
"externalToolNamespaces": "all",
"activeTurnModel": "<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
1"agent_abc123"
Body
Deprecated alias for instructions; accepted for backwards compatibility.
Per-thread tool subset. Omit to inherit the agent's full effective tools; pass [] to run with no configurable tools. Provided entries can only narrow the agent's 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.
1Response
Thread created.
idle threads can accept a new turn or be closed. running threads have an active turn. awaiting threads are paused on external input such as approvals. closed threads are terminal.
idle, running, awaiting, closed Show child attributes
Show child attributes
Show child attributes
Show child attributes
completed, failed, null Show child attributes
Show child attributes
Show child attributes
Show child attributes
get_time, sub_thread, wait, tool.call, tool.discover, artifact.read, agent.threads.list, agent.threads.get, agent.approvals.cancel, agent.approvals.grant_thread, agent.approvals.grant_agent, agent.create, agent.approvals.update, tool.connect, sandbox.exec, sandbox.read, sandbox.write_file, sandbox.read_file, sandbox.spawn, sandbox.stdin, sandbox.session_read, sandbox.kill, sandbox.list_sessions, sandbox.sync_artifact, memory.read, memory.list, memory.search, memory.write, memory.delete, db.query, web.search, web.fetch, agent.schedule.list, agent.schedule.create, agent.schedule.update, agent.schedule.delete, agent.schedule.trigger Show child attributes
Show child attributes
all