POST

Run Python, Node, or Bash code in an isolated sandbox with optional files, env, and network; returns output. Dynamic pricing: ceil(timeout_ms × 10000 / 60000), ×2 if allow_network=true. Powered by Modal

/v1/agent/sandbox

Powered by Modal

Request → Response

Examples from schemas.json.

Requestapplication/json
POST /v1/agent/sandbox
Content-Type: application/json

{
  "language": "python",
  "code": "example",
  "timeout_ms": 30000,
  "allow_network": false
}
Responseapplication/json
HTTP/1.1 200 OK
Content-Type: application/json

// Endpoint-specific body after 402 settlement

Overview

Run Python, Node, or Bash code in an isolated sandbox with optional files, env, and network; returns output. Dynamic pricing: ceil(timeout_ms × 10000 / 60000), ×2 if allow_network=true. Powered by Modal.

Serverless cloud platform for running AI and compute workloads.

Request schema

Body: JSON · application/json

FieldTypeDescription
languagestringrequiredenum: python, node, bash
codestringrequired
timeout_msintegerrequiredmin: 100
filesobjectoptional
envobjectoptional
allow_networkbooleanrequired
IMPLEMENTATION
curl -X POST https://api.tools402.dev/v1/agent/sandbox \
  -H "Content-Type: application/json" \
  -d '{
  "language": "python",
  "code": "example",
  "timeout_ms": 30000,
  "allow_network": false
}'

402 payment flow omitted — see Integrations for settlement.