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);import os
from cerca import Cerca
client = Cerca(
api_key=os.environ.get("CERCA_API_KEY"), # This is the default and can be omitted
)
exec_result = client.sandbox.exec(
agent_id="agent_abc123",
command="command",
)
print(exec_result.exit_code)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"),
)
execResult, err := client.Sandbox.Exec(
context.TODO(),
"agent_abc123",
cercago.SandboxExecParams{
Command: cercago.F("command"),
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", execResult.ExitCode)
}require "cerca"
cerca = Cerca::Client.new(api_key: "My API Key")
exec_result = cerca.sandbox.exec_("agent_abc123", command: "command")
puts(exec_result)cerca sandbox exec \
--api-key 'My API Key' \
--agent-id agent_abc123 \
--command commandcurl --request POST \
--url https://api.cerca.dev/agents/{agentId}/sandbox/exec \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"command": "<string>",
"maxBuffer": 123,
"timeout": 30,
"workdir": "/home/user"
}
'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.cerca.dev/agents/{agentId}/sandbox/exec",
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([
'command' => '<string>',
'maxBuffer' => 123,
'timeout' => 30,
'workdir' => '/home/user'
]),
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}/sandbox/exec")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"command\": \"<string>\",\n \"maxBuffer\": 123,\n \"timeout\": 30,\n \"workdir\": \"/home/user\"\n}")
.asString();{
"exitCode": 123,
"handle": "<string>",
"stderr": "<string>",
"stderrOffset": 123,
"stdout": "<string>",
"stdoutOffset": 123
}{
"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"
}Sandbox
Execute sandbox command
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);import os
from cerca import Cerca
client = Cerca(
api_key=os.environ.get("CERCA_API_KEY"), # This is the default and can be omitted
)
exec_result = client.sandbox.exec(
agent_id="agent_abc123",
command="command",
)
print(exec_result.exit_code)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"),
)
execResult, err := client.Sandbox.Exec(
context.TODO(),
"agent_abc123",
cercago.SandboxExecParams{
Command: cercago.F("command"),
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", execResult.ExitCode)
}require "cerca"
cerca = Cerca::Client.new(api_key: "My API Key")
exec_result = cerca.sandbox.exec_("agent_abc123", command: "command")
puts(exec_result)cerca sandbox exec \
--api-key 'My API Key' \
--agent-id agent_abc123 \
--command commandcurl --request POST \
--url https://api.cerca.dev/agents/{agentId}/sandbox/exec \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"command": "<string>",
"maxBuffer": 123,
"timeout": 30,
"workdir": "/home/user"
}
'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.cerca.dev/agents/{agentId}/sandbox/exec",
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([
'command' => '<string>',
'maxBuffer' => 123,
'timeout' => 30,
'workdir' => '/home/user'
]),
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}/sandbox/exec")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"command\": \"<string>\",\n \"maxBuffer\": 123,\n \"timeout\": 30,\n \"workdir\": \"/home/user\"\n}")
.asString();{
"exitCode": 123,
"handle": "<string>",
"stderr": "<string>",
"stderrOffset": 123,
"stdout": "<string>",
"stdoutOffset": 123
}{
"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"
Body
application/json
⌘I