Execute JavaScript, Python, and Bash code in secure sandboxes via a simple REST API. No server setup. Get stdout, stderr, and exit codes instantly.
// Click "Run Code" to see output
JavaScript (Node.js 20), Python 3, and Bash. Each runs in its own isolated environment with standard libraries available.
Code runs in isolated containers with resource limits. CPU, memory, and time are capped. No filesystem or network access from sandbox.
Get stdout, stderr, exit code, and execution time in milliseconds. Debug errors with complete stack traces.
Default 10-second timeout prevents infinite loops. Configurable per request for longer-running computations.
Give your LLM the ability to execute code. Perfect as a tool for CrewAI, LangChain, AutoGPT, and MCP agents.
No Docker, no VMs, no language runtimes to install. Send code via API, get results back. That's it.
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/code/run | Execute code in specified language |
Request body: {"language": "javascript", "code": "console.log('hello')"}
# Run JavaScript
curl -X POST "https://agent-gateway-kappa.vercel.app/api/code/run" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"language": "javascript", "code": "console.log(2 + 2)"}'
# Response:
{
"stdout": "4\n",
"stderr": "",
"exitCode": 0,
"executionTime": 45
}
# Run Python
curl -X POST "https://agent-gateway-kappa.vercel.app/api/code/run" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"language": "python", "code": "print(sum(range(100)))"}'
const API_KEY = 'YOUR_API_KEY';
const BASE = 'https://agent-gateway-kappa.vercel.app';
// Execute Python code
const res = await fetch(`${BASE}/api/code/run`, {
method: 'POST',
headers: {
'Authorization': `Bearer ${API_KEY}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
language: 'python',
code: 'import math\nprint(math.pi)'
})
});
const { stdout, executionTime } = await res.json();
console.log(stdout); // "3.141592653589793\n"
import requests
API_KEY = "YOUR_API_KEY"
BASE = "https://agent-gateway-kappa.vercel.app"
# Execute JavaScript code
r = requests.post(
f"{BASE}/api/code/run",
headers={
"Authorization": f"Bearer {API_KEY}",
"Content-Type": "application/json"
},
json={"language": "javascript", "code": "console.log(Array.from({length:5},(_,i)=>i*i))"}
)
result = r.json()
print(result["stdout"]) # [0, 1, 4, 9, 16]
Give your LLM code execution capabilities. Let it write and run code to solve math, data processing, and validation tasks.
Build interactive code editors for tutorials, documentation, or educational platforms. No backend infrastructure needed.
Run test suites, validate outputs, and check code correctness in CI/CD pipelines without managing test environments.
Run one-off data transformation scripts. Parse CSV, calculate statistics, or transform JSON without spinning up servers.
200 free credits. No Docker. No VMs. Execute code in seconds.
Get Started Free