{"uid":"cap_mMyN5p7jolZs9cvgB5QGj","slug":"agent402-tools-code-execution-sandbox-ed664c07","name":"agent402.tools Code Execution Sandbox","description":"Execute Python or JavaScript code in a secure, isolated cloud sandbox. Returns stdout, stderr, and the expression result. No setup needed; pay per call via x402. 30s timeout, 10k char code limit.","url":"https://agent402.tools/api/code-run","method":"POST","headers":{},"bodySchema":{"type":"object","properties":{"code":{"type":"string","description":"Source code to execute (max 10,000 chars)"},"language":{"type":"string","description":"Language: python (default) or javascript"}}},"responseSchema":{"type":"json","example":{"error":null,"result":null,"stderr":"","stdout":"Hello from Agent402!\n","language":"python"}},"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.02","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","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.02/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.02","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.02","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_QkIAG3cQpQODrdlun5rdj","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.02","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Executes Python or JavaScript code in a secure cloud sandbox and returns stdout, stderr, and expression results","exampleAgentPrompt":"Run this Python code in a secure sandbox and tell me what it prints: `import math; result = [math.factorial(n) for n in range(10)]; print(result)`","exampleUseCases":null,"resultDescription":"Returns stdout (printed output), stderr (error messages or warnings), and the evaluated expression result from the executed code snippet, all as structured fields.","failureModes":["Code exceeds 10,000 character limit — request rejected","Execution exceeds 30-second timeout — returns timeout error","Syntax errors in code — returned in stderr field","Unsupported language specified — error response","Payment via x402 fails or is insufficient — 402 Payment Required response","Runtime exceptions in code — captured in stderr, stdout may be partial"],"whenToPreferThis":"Use this endpoint when you need to run a short Python or JavaScript snippet in a fully isolated, no-setup cloud environment and get back the output immediately. Ideal for dynamic computations, data transformations, quick algorithmic tasks, or evaluating untrusted code safely. Prefer over local execution when the agent has no local runtime, or when sandboxing is required for security. Not suitable for long-running jobs (>30s), code requiring external dependencies not pre-installed, or code larger than 10,000 characters.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-09-14T19:14:04.657Z","isFirstParty":false}