{"uid":"cap_R8l-p_VZ6u5dvgml_u26D","slug":"x402engine-code-execution-sandbox-c874cb4a","name":"x402engine Code Execution Sandbox","description":"Run code in isolated sandbox — Python, JavaScript, Bash, R (up to 5 min)","url":"https://x402engine.app/api/code/run?utm_source=zero.xyz","method":"POST","headers":{},"bodySchema":{"type":"object","$schema":"https://json-schema.org/draft/2020-12/schema","required":["input"],"properties":{"input":{"type":"object","required":["type","bodyType","body","method"],"properties":{"body":{"type":"object","required":["code"],"properties":{"code":{"type":"string","example":"print(\"hello\")","description":"Code to execute"},"timeout":{"type":"number","default":60,"example":60,"description":"Execution timeout in seconds (1-300)"},"language":{"type":"string","default":"python","example":"python","description":"Programming language (python, javascript, bash, r)"}},"additionalProperties":false},"type":{"type":"string","const":"http"},"method":{"enum":["POST"],"type":"string"},"bodyType":{"enum":["json","form-data","text"],"type":"string"}},"additionalProperties":false}}},"responseSchema":null,"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.005","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"registry","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.005/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.005","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.005","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_LS2VB5EpwDi1NC9tM5HYi","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.005","costPer":"request","priority":0,"asset":null,"unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Runs arbitrary code in an isolated sandbox supporting Python, JavaScript, Bash, and R, returning stdout/stderr and results","exampleAgentPrompt":"Can you run this Python snippet for me in a sandbox and give me the output: `import math; print(math.factorial(20))`? Set a 30-second timeout.","exampleUseCases":[{"title":"Data processing with Python script","prompt":"Run this Python code for me and return the output: `import json; data = [1,2,3,4,5]; print(json.dumps({'sum': sum(data), 'mean': sum(data)/len(data)}))`  — give it a 60-second timeout."},{"title":"Quick JavaScript logic test","prompt":"Execute this JavaScript snippet in a sandboxed environment and show me what it prints: `const fib = n => n <= 1 ? n : fib(n-1)+fib(n-2); console.log(fib(10));`"},{"title":"Bash shell script execution","prompt":"Run this bash script remotely in a safe sandbox: `for i in 1 2 3 4 5; do echo \"Iteration $i\"; done` — use bash as the language and a 30-second timeout."}],"resultDescription":"Returns the captured stdout and stderr from the code execution, along with execution status (success or error), exit code, and elapsed time. If the code produces a return value or raised an exception, those details are also included.","failureModes":["Timeout exceeded if code runs longer than the specified timeout (max 300s)","Syntax errors in code cause a non-zero exit code with error message in stderr","Unsupported language value returns a validation error","Code attempting to access restricted system resources may be blocked by sandbox","Payment failure (HTTP 402) if USDC balance is insufficient"],"whenToPreferThis":"Choose this endpoint when you need to execute arbitrary code in a safe, isolated environment without provisioning your own compute, especially for short-lived tasks up to 5 minutes. It supports Python, JavaScript, Bash, and R, making it versatile for data analysis, scripting, and logic evaluation. Prefer it over local execution when security isolation is required or when operating as an AI agent without a native code interpreter.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-02T02:30:28.497Z","isFirstParty":false,"canonicalSlug":"x402engine-code-execution-sandbox-c874cb4a"}