Skip to main content
Glama

AST-Audited Ephemeral Python Code Execution Sandbox

execute_python_sandbox
Read-onlyIdempotent

Audit 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

NameRequiredDescriptionDefault
python_scriptYesPython 3 source script to audit and execute strictly inside an isolated AST-governed, non-privileged WebAssembly sandbox with no host filesystem access.
timeout_profileNoExecution resource ceiling; defaults to 'standard_5s' when omitted.

Output Schema

NameRequiredDescriptionDefault
exit_codeYesProcess exit status (0 on clean execution, 1 on security block).
syntax_validYesTrue if the Python source parses without syntax errors.
simulated_stdoutYesCaptured standard output from the isolated execution.
ast_security_auditYesStatic syscall audit summary including flagged_calls and safety_verdict.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv1.3.3

TDQS

A4.2/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations declare the safety profile (readOnly/idempotent/non-destructive), but the description adds real context beyond them: statelessness, 32 KB size cap, 60 RPM rate limit, MPP payment of 1500 sats, demo flag, and HTTP 400 on invalid input. It does not explain what the audit does with rejected scripts (error vs. refusal), leaving one behavioral gap.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loads the sandbox/austerity purpose, then alternates, then limits and payment in one dense but ordered block. Every clause carries information; only minor cramming of demo/MPP/rate-limit details prevents a 5.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

An output schema exists, so return values need no explanation, and the description supplies limits, payment, error behavior, and the sibling alternative. The only real shortfall is the conflicting timeout default, which leaves an agent uncertain about execution ceilings.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the schema already defines both parameters (baseline 3). However, the description states 'timeout_profile' defaults to 'fast_1s' while the schema's own description says it 'defaults to standard_5s when omitted' — a misleading inconsistency that actively contradicts the structured field it should reinforce.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Specific verb (executes) plus resource (Python source) with concrete scope: audits forbidden syscalls inside an AST-governed WebAssembly sandbox. It explicitly distinguishes itself from the sibling verify_agent_command_safety, so an agent can route without opening either schema.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

States the exact use case ('executing LLM-generated Python snippets safely') and names the alternative plus the condition that selects it ('for checking shell commands without executing code, use verify_agent_command_safety instead'). When-to-use, when-not-to-use, and the alternative are all present.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Deploy Server

Other Tools