# Sasona Python Sandbox Code Runner

> Sasona Python Sandbox Code Runner is a paid API for AI agents from router.sasona.ai, paid per call via x402, $0.0079/call, status unknown (last checked 2026-11-13).

Executes arbitrary Python code in an isolated sandbox and returns stdout, exit status, execution time, and memory usage

## Facts

- Endpoint: POST https://router.sasona.ai/x402/run-code/payai?utm_source=zero.xyz
- Price: $0.0079/call
- Payment: x402
- Status: unknown
- Last checked: 2026-11-13
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/sasona-python-sandbox-code-runner-02f00792
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_wC-8WjosXr5H6bxQrImOB

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability sasona-python-sandbox-code-runner-02f00792 -d '<json body>'
```

Example prompt: Run this Python snippet for me in a sandbox and tell me what it prints: `import math; print(math.factorial(20))`

## When to prefer this

Choose this endpoint when an AI agent needs to run a small, self-contained Python snippet to perform a calculation, parse data, or apply a transformation without provisioning a local runtime, cloud function, or any personal infrastructure. It is ideal for agentic workflows where the agent itself writes code to solve a sub-problem and needs to execute it immediately. Prefer it over general compute services when simplicity and zero-setup are priorities and the task fits within a single Python script's stdout.

## Known failure modes

- Code raises an unhandled exception — exit status is non-zero and stderr/stdout may contain traceback
- Execution timeout exceeded — sandbox kills the process and returns a timeout error
- Memory limit exceeded — sandbox terminates the process with an out-of-memory exit status
- Syntax errors in the submitted Python — exit status non-zero with SyntaxError in output
- Import of disallowed or unavailable modules — ImportError in stdout and non-zero exit
- Malformed request body — HTTP 400 or validation error returned before execution begins

## How this service works

Runs Python you send in a sandbox and returns its stdout, exit status, time and memory. Use it to execute code an agent wrote - a calculation, a parse, a transformation - without a machine, an account or an API key of your own.

## Output

Returns the Python process's stdout as a string, the exit status code (0 for success, non-zero for errors), wall-clock execution time in milliseconds, and peak memory usage in bytes — giving the agent everything it needs to know whether the code ran successfully and what it produced.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "required": [
  "input"
 ],
 "properties": {
  "input": {
   "type": "object",
   "required": [
    "type",
    "method",
    "bodyType",
    "body"
   ],
   "properties": {
    "body": {
     "type": "object"
    },
    "type": {
     "type": "string",
     "const": "http"
    },
    "method": {
     "enum": [
      "POST",
      "PUT",
      "PATCH"
     ],
     "type": "string"
    },
    "headers": {
     "type": "object",
     "additionalProperties": {
      "type": "string"
     }
    },
    "bodyType": {
     "enum": [
      "json",
      "form-data",
      "text"
     ],
     "type": "string"
    },
    "queryParams": {
     "type": "object",
     "additionalProperties": {
      "type": "string"
     }
    }
   },
   "additionalProperties": false
  },
  "output": {
   "type": "object",
   "required": [
    "type"
   ],
   "properties": {
    "type": {
     "type": "string"
    },
    "example": {
     "type": "object"
    }
   }
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/sasona-python-sandbox-code-runner-02f00792/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from router.sasona.ai](https://www.zero.xyz/host/router.sasona.ai/llms.txt)
