# Batcave Python Sandbox Runner

> Batcave Python Sandbox Runner is a paid API for AI agents from batcave-x402-gateway.darriel9.workers.dev, paid per call via x402, $0.01/call, status unknown (last checked 2026-09-14).

Executes supplied Python files in a disposable, isolated sandbox and returns stdout, stderr, exit code, and requested output artifacts.

## Facts

- Endpoint: POST https://batcave-x402-gateway.darriel9.workers.dev/v1/run-python
- Price: $0.01/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-14
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/batcave-python-sandbox-runner-a1a55cec
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_PviAgSIxH3Emo5btxKZM8

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 batcave-python-sandbox-runner-a1a55cec -d '<json body>'
```

Example prompt: Run this Python script for me in an isolated sandbox — here are the files: main.py contains `print('hello world')` — give it 10 seconds, 256 MB of memory, and return all stdout and stderr.

## When to prefer this

Choose this endpoint when you need to safely execute untrusted or user-supplied Python code in a fully isolated, disposable environment with no network, GPU, or host access. Ideal for reproducing bugs, running unit tests, executing data-processing scripts, or collecting generated file artifacts. Prefer this over general compute when strict sandboxing, artifact capture, and controlled resource limits (CPU ≤ 2, memory ≤ 1024 MB, timeout ≤ 30s) are required.

## Known failure modes

- Timeout exceeded (timeout_seconds limit reached) — execution halted, partial output may be returned
- Memory limit exceeded (memory_mb cap hit) — process killed
- Invalid or unparseable Python files — syntax errors reflected in stderr
- Requested artifact path not found after execution — artifact missing from response
- Payment failure — x402 payment of $0.01 USDC not processed
- Too many files provided (exceeds maxProperties: 64) — request rejected

## How this service works

Run supplied Python files in a disposable isolated environment and return execution evidence and requested artifacts. Use when you need to execute untrusted Python code, run tests, reproduce a failure, or collect stdout/stderr and generated artifacts without giving the code network, GPU, or host access.

## Output

Returns execution evidence including stdout, stderr, and exit code from the Python run, plus the binary or text content of any artifact files specified in artifact_paths that were written during execution.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "cpus": {
   "type": "number",
   "maximum": 2,
   "minimum": 0.1
  },
  "files": {
   "type": "object",
   "description": "Relative file path -> UTF-8 text content.",
   "maxProperties": 64,
   "minProperties": 1,
   "additionalProperties": {
    "type": "string"
   }
  },
  "stdin": {
   "type": "string"
  },
  "job_id": {
   "type": "string"
  },
  "command": {
   "type": "array",
   "items": {
    "type": "string"
   },
   "description": "Optional argv; defaults to ['python','main.py']."
  },
  "runtime": {
   "enum": [
    "python"
   ],
   "type": "string"
  },
  "memory_mb": {
   "type": "integer",
   "maximum": 1024,
   "minimum": 64
  },
  "artifact_paths": {
   "type": "array",
   "items": {
    "type": "string"
   },
   "maxItems": 16
  },
  "timeout_seconds": {
   "type": "integer",
   "maximum": 30,
   "minimum": 1
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/batcave-python-sandbox-runner-a1a55cec/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from batcave-x402-gateway.darriel9.workers.dev](https://www.zero.xyz/host/batcave-x402-gateway.darriel9.workers.dev/llms.txt)
