Trace Execution
trace_executionTrace code execution line-by-line for a specific input, revealing which statements ran, in what order, with variable values and branch decisions. See exact paths taken versus skipped to debug why behavior occurred.
Instructions
Debug WHY, line by line, for the ONE input you actually ran it on: which statements fired, in what order, with what variable values at each step, and which if/elif/while/for/try branch was taken versus never taken. Want just the printed output instead? Use execute_code.
Returns events: ordered {step, line, event, func, locals}, one entry
per traced line/call/return/exception in YOUR code only (library
internals excluded). locals on each entry is only the names that
changed since the previous step in that same call — not a full dump
every line. A return entry also carries return_value; an
exception entry carries exception_type/exception_message.
Also returns branches (hit count per if/elif/while/for/try line),
lines_executed / lines_never_executed (coverage from a static parse),
and truncated/truncated_reason when max_events or an internal
size ceiling stopped RECORDING early (the underlying stdout/exit code
are unaffected either way).
TRUST: the trace is produced BY the traced program at its OWN privilege
— a debugging aid, not an attestation of behaviour, exactly as
trustworthy as that program's own stdout. discarded_events /
events_consistent are a best-effort tamper/corruption signal (never a
guarantee) computed independently of the file's own content.
unenforced may additionally note "only the main thread is traced"
(sys.settrace is per-thread) or, fallback backend only, an OLE
exit_code race.
For a structural Big-O guess with nothing executed, use analyze_complexity.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | Source code to trace line by line | |
| stdin | No | Text piped to the program's standard input; empty means no input | |
| no_net | No | Block outbound network access for this run; best-effort on platforms without seccomp | |
| max_cpu | No | Per-call CPU-time ceiling in seconds; 0 means no explicit limit is set | |
| timeout | No | Wall-clock seconds before the run is killed; clamped to a 120s ceiling | |
| language | Yes | Runtime to trace; only 'python3' is supported, any other value is refused | |
| provider | No | Execution backend id; only 'local' (the default) is supported here | |
| max_events | No | Max trace events to record before truncating; the run's own stdout/exit code are unaffected | |
| max_memory_mb | No | Per-call memory ceiling in MiB; 0 means no explicit limit is set | |
| max_output_kb | No | Stdout/stderr capture cap in KiB per stream; 0 uses the 64 KiB default, hard-clamped to 240 |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||