Tools & Sandbox

Build custom tools with the Tool Builder and execute code in isolated sandbox environments with resource limits and security controls.

Tool Builder

List Tools

GET /v1/tools

The organization is taken from the authenticated session.

Query Parameters

ParameterTypeDescription
statusstringFilter: draft, testing, deployed, disabled
pageinteger1-based page number
page_sizeintegerResults per page (default: 25, max: 100)

Response

{
  "data": {
    "items": [
      {
        "id": "...",
        "name": "Cost Estimator",
        "description": "Estimate construction costs based on materials and labor",
        "tool_type": "api",
        "status": "deployed",
        "created_at": "2026-03-01T10:00:00Z",
        "updated_at": "2026-04-10T14:30:00Z"
      }
    ],
    "total": 5,
    "page": 1,
    "page_size": 25
  }
}

Create Tool

POST /v1/tools

The organization is taken from the authenticated session and must not be sent in the body (unknown fields are rejected).

Request Body

{
  "name": "Cost Estimator",
  "description": "Estimate construction costs based on materials and labor",
  "tool_type": "api",
  "schema_def": {
    "input": {
      "type": "object",
      "properties": {
        "materials": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "name": { "type": "string" },
              "quantity": { "type": "number" },
              "unit_cost": { "type": "number" }
            }
          }
        },
        "labor_hours": { "type": "number" }
      }
    },
    "output": {
      "type": "object",
      "properties": {
        "total_cost": { "type": "number" },
        "breakdown": { "type": "object" }
      }
    }
  },
  "endpoint_url": "https://api.example.com/estimate",
  "auth_config": {
    "type": "bearer",
    "token_env": "ESTIMATOR_API_KEY"
  }
}

Tool Schema Fields

FieldTypeDescription
namestringDisplay name for the tool
descriptionstringWhat the tool does (shown to AI assistant)
tool_typestringTool type: api, function, script
schema_defobjectJSON Schema defining input and output
endpoint_urlstringURL to invoke for API tools
auth_configobjectAuthentication configuration for the endpoint

Do not send id, created_at, updated_at, or org_id in the request body; these are assigned by the server and any unknown field is rejected.

Response

A successful create returns 201 Created with the complete tool record inside the standard envelope. New tools start in draft status at version 1.

{
  "success": true,
  "data": {
    "id": "...",
    "org_id": "...",
    "name": "Cost Estimator",
    "description": "Estimate construction costs based on materials and labor",
    "tool_type": "api",
    "schema_def": { },
    "endpoint_url": "https://api.example.com/estimate",
    "auth_config": { "type": "bearer", "token_env": "ESTIMATOR_API_KEY" },
    "status": "draft",
    "version": 1,
    "created_by": "...",
    "created_at": "2026-03-01T10:00:00Z",
    "updated_at": "2026-03-01T10:00:00Z"
  }
}

Response Codes

StatusMeaning
201 CreatedTool created; the full record is returned
400 Bad RequestRequest body failed validation, contained an unknown field, was not valid JSON, or carried a blocked endpoint_url
401 UnauthorizedMissing or invalid authentication
403 ForbiddenCaller lacks the permission to create tools
409 ConflictA tool with the same name already exists in the organization
500 Internal Server ErrorUnexpected server error

Get Tool

GET /v1/tools/:id

Update Tool

PUT /v1/tools/:id

Delete Tool

DELETE /v1/tools/:id

Tool Status Lifecycle

StatusDescription
draftUnder development, not available to the AI assistant
testingAvailable in test mode for validation
deployedLive and available to the AI assistant
disabledTemporarily disabled, not available

Sandbox

Provision Sandbox

POST /v1/sandbox

The organization is taken from the authenticated session. A session id is minted automatically when one is not supplied. An optional Git repository can be cloned into the workspace on provision.

Request Body

{
  "sessionId": "...",
  "size": "standard-1",
  "gitRepo": "owner/repo",
  "gitBranch": "main",
  "envVars": {
    "DATA_DIR": "/workspace/data"
  }
}

Sandbox Sizes

Sandboxes run on named instance types. standard-1 is the default. The legacy tokens small, standard, and large are still accepted and map to standard-2, standard-3, and standard-4 respectively.

SizeDescription
basicSmallest instance for lightweight tasks
standard-1General-purpose execution (default)
standard-2Larger general-purpose workloads
standard-3Compute-heavy tasks
standard-4Largest instance for the heaviest workloads

A sandbox is an ephemeral, isolated runtime session rather than a stored record, so the request body carries only provisioning inputs. Do not send org_id; it is taken from the authenticated session.

Response

A successful provision returns 201 Created with the session handle inside the standard envelope.

{
  "success": true,
  "data": {
    "sessionId": "...",
    "sandboxId": "...",
    "size": "standard-1",
    "status": "ready"
  }
}

Response Codes

StatusMeaning
201 CreatedSandbox provisioned and ready
400 Bad RequestProvisioning inputs failed validation (size, git repo, or branch)
401 UnauthorizedMissing or invalid authentication
403 ForbiddenCaller lacks sandbox access (no active plan or compute credits)
409 ConflictThe supplied sessionId is already in use
500 Internal Server ErrorProvisioning failed before the sandbox started
502 Bad GatewayThe sandbox runtime failed to initialize

Get Sandbox Status

GET /v1/sandbox/status/:sessionId

Response

{
  "data": {
    "active": true,
    "status": "ready",
    "canResume": false
  }
}

A stopped sandbox reports active: false with canResume: true; resume it with POST /v1/sandbox/resume/:sessionId.

Run Shell Commands

POST /v1/sandbox/terminal/:sessionId

Drive an interactive shell inside the sandbox. The action selects the operation: create a shell session, write input, read the buffer, or exec a command and capture its output.

Request Body (exec example)

{
  "action": "exec",
  "command": "python -c 'print(42)'",
  "timeout": 30000,
  "workdir": "/workspace"
}

Security Restrictions

Each sandbox runs in a fully isolated, per-session environment with strict per-organization isolation, so one tenant can never reach another tenant’s sandbox. Shell output returned to callers is scrubbed to avoid persisting credentials into client transcripts.

Tear Down Sandbox

POST /v1/sandbox/teardown/:sessionId

Stops the sandbox and releases its compute resources. The session record is retained so the same sessionId can later be resumed from its saved snapshot; to start completely fresh, provision with a new sessionId.