Skip to main content
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);
{
  "completedAt": "<string>",
  "endMessageSeq": 123,
  "error": "<string>",
  "id": "<string>",
  "result": "<string>",
  "seq": 123,
  "startMessageSeq": 123,
  "startedAt": "<string>",
  "threadId": "<string>",
  "tokenUsage": {
    "inputTokens": 123,
    "outputTokens": 123
  },
  "message": "<string>"
}

Documentation Index

Fetch the complete documentation index at: https://docs.cerca.dev/llms.txt

Use this file to discover all available pages before exploring further.

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

agentId
string
required
Minimum string length: 1
Example:

"agent_abc123"

threadId
string
required
Minimum string length: 1
Example:

"thread_abc123"

Body

application/json
message
string
required
model
string
tools
string[]

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: 1

Response

Thread turn started.

completedAt
string | null
required
endMessageSeq
number | null
required
error
string | null
required
id
string
required
result
string | null
required
seq
number
required
startMessageSeq
number
required
startedAt
string
required
status
enum<string>
required
Available options:
running,
completed,
failed
threadId
string
required
tokenUsage
object
required
message
string
required