Skip to main content
POST
/
agents
/
{agentId}
/
sandbox
/
exec
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 execResult = await client.sandbox.exec('agent_abc123', { command: 'command' });

console.log(execResult.exitCode);
{
  "exitCode": 123,
  "handle": "<string>",
  "stderr": "<string>",
  "stderrOffset": 123,
  "stdout": "<string>",
  "stdoutOffset": 123
}

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"

Body

application/json
command
string
required
maxBuffer
number
timeout
number

Timeout in seconds. Runtime converts this to milliseconds.

Example:

30

workdir
string | null

Optional sandbox working directory.

Example:

"/home/user"

{key}
any

Response

Sandbox command result.

exitCode
number | null
required
handle
string
required
state
enum<string>
required
Available options:
running,
exited
stderr
string
required
stderrOffset
number
required
stdout
string
required
stdoutOffset
number
required