execute_code
Run code in 30+ languages inside a sandbox with resource limits, network controls, and persistent sessions, returning stdout, stderr, exit code, timing, and memory usage.
Instructions
Execute code in language in a sandbox.
Returns stdout, stderr, exit_code, duration_ms, cpu_ms, peak_memory_kb, verdict (OK/TLE/MLE/OLE/RTE).
session_id: run inside a session workspace (see session_start); with a stateful session (python3/node) interpreter state persists across calls.max_memory_mb/max_cpu: per-call resource ceilings.max_output_kb: raise/lower the stdout cap (default 64 KiB).no_net: block network egress. Linux: enforced in-kernel via a seccomp-bpf filter. macOS / no-seccomp kernel: best-effort symbol shim, disclosed inunenforcedwhen that's the only guarantee that held. See SECURITY.md.compact: drop the diagnostic fields (timings, workdir, platform). Never dropsunenforcedoroutput_error— if a guarantee you asked for was not applied, a compact result still says so.
With session_id set and max_output_kb left at its default, output that
would otherwise be truncated is instead SPILLED: the inline
stdout/stderr still carry the same truncated prefix as before, and
stdout_spill/stderr_spill name a codecalc://session/{sid}/files/...
resource carrying the fuller stream (session_read_file or the resource
route reads it back) — capped at 4 MiB, ..._spill_capped: true if even
that was not enough to hold everything. Passing an EXPLICIT
max_output_kb is honoured as a literal ceiling with no spill, same as
before. Session-LESS runs (no session_id) have no workspace to spill
into and keep the old truncate-and-drop behaviour.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | ||
| stdin | No | ||
| no_net | No | ||
| compact | No | ||
| max_cpu | No | ||
| timeout | No | ||
| language | Yes | ||
| provider | No | ||
| session_id | No | ||
| max_memory_mb | No | ||
| max_output_kb | No |