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.retrieve('agent_abc123', 'thread_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.retrieve(
agent_id="agent_abc123",
thread_id="thread_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.Get(
context.TODO(),
"agent_abc123",
"thread_abc123",
cercago.ThreadGetParams{},
)
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.retrieve("agent_abc123", "thread_abc123")
puts(thread)cerca threads retrieve \
--api-key 'My API Key' \
--agent-id agent_abc123 \
--thread-id thread_abc123curl --request GET \
--url https://api.cerca.dev/agents/{agentId}/threads/{threadId} \
--header 'Authorization: Bearer <token>'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.cerca.dev/agents/{agentId}/threads/{threadId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.get("https://api.cerca.dev/agents/{agentId}/threads/{threadId}")
.header("Authorization", "Bearer <token>")
.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"
}Retrieve 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.retrieve('agent_abc123', 'thread_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.retrieve(
agent_id="agent_abc123",
thread_id="thread_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.Get(
context.TODO(),
"agent_abc123",
"thread_abc123",
cercago.ThreadGetParams{},
)
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.retrieve("agent_abc123", "thread_abc123")
puts(thread)cerca threads retrieve \
--api-key 'My API Key' \
--agent-id agent_abc123 \
--thread-id thread_abc123curl --request GET \
--url https://api.cerca.dev/agents/{agentId}/threads/{threadId} \
--header 'Authorization: Bearer <token>'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.cerca.dev/agents/{agentId}/threads/{threadId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.get("https://api.cerca.dev/agents/{agentId}/threads/{threadId}")
.header("Authorization", "Bearer <token>")
.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"
1"thread_abc123"
Query Parameters
Return messages newer than this sequence number. Mutually exclusive with beforeSeq.
^\d+$"42"
Return messages older than this sequence number. Mutually exclusive with afterSeq.
^\d+$"42"
When true, includes debug-only compiled context fields.
true, false "false"
Deprecated compatibility flag. Thread detail includes a bounded recent message page by default; pass false only to opt out when no message pagination params are present.
true, false "true"
Maximum number of messages to include, capped at 500. Set to 0 to return metadata without messages.
^\d+$"50"
Response
Thread detail.
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