inspect_code_ast_safety
Scan Python source code for dangerous AST operations such as eval, exec, subprocess, and sockets before sandbox execution. Validate raw code to block system manipulation and token exfiltration.
Instructions
Deterministic Python Abstract Syntax Tree (AST) parser scanning for hazardous operations (subprocess, os.system, eval, exec, socket, token exfiltration). Use this tool ONLY when validating raw Python source code or shell scripts for dangerous AST operations (e.g., eval, exec, subprocess, socket connections, system manipulation) prior to sandbox execution. Do NOT use this tool for natural language text or generic agent messages; use verify_agent_output or inspect_agent_output instead.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | The Python source code snippet to parse, validate, and audit via deterministic AST visitor. | import math def calculate_roi(p, r, t): return p * (1 + r * t) |