AST-Audited Ephemeral Python Code Execution Sandbox
execute_python_sandboxAudit and execute LLM-generated Python snippets in an isolated AST-governed WebAssembly sandbox without host filesystem access, blocking forbidden syscalls before code runs.
Instructions
Audits Python source code for forbidden syscalls (os, subprocess, socket, open, eval) inside an AST-governed WebAssembly sandbox with no host filesystem access. Use when executing LLM-generated Python snippets safely; for checking shell commands without executing code, use verify_agent_command_safety instead. Stateless read-only edge call (max 32 KB, 60 RPM): accepts 'python_script' ('timeout_profile' defaults to 'fast_1s'), supports '?demo=true' or MPP (1500 sats), and returns HTTP 400 if invalid.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| python_script | Yes | Python 3 source script to audit and execute strictly inside an isolated AST-governed, non-privileged WebAssembly sandbox with no host filesystem access. | |
| timeout_profile | No | Execution resource ceiling; defaults to 'standard_5s' when omitted. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| exit_code | Yes | Process exit status (0 on clean execution, 1 on security block). | |
| syntax_valid | Yes | True if the Python source parses without syntax errors. | |
| simulated_stdout | Yes | Captured standard output from the isolated execution. | |
| ast_security_audit | Yes | Static syscall audit summary including flagged_calls and safety_verdict. |