snoop
Non-interactive Python debugging via automatic variable tracing — traces function execution and prints variable changes without a debugger. snoop features: @snoop decorator for automatic trace logging, snoop() context manager for block tracing, pp() for pretty-print with expression display, watch= parameter for tracking non-local variables, depth= for tracing called functions, out= for file/stream output, prefix= for log identification, columns= for timestamp/thread display, enabled= flag for conditional tracing, and pysnooper compatibility. Prints every line executed with variable values — debugging without breakpoints.
Score Breakdown
⚙ Agent Friendliness
🔒 Security
snoop automatically logs ALL local variables including passwords, tokens, and PII. Never leave @snoop on functions handling credentials. Use enabled=False flag or conditional enabling. Redirect output to secure log file not stdout when debugging in shared environments. Remove all snoop decorators before production deployment.
⚡ Reliability
Best When
Debugging complex functions without interactive debugger access — snoop's automatic variable tracing reveals execution flow in non-interactive environments (containers, CI logs, remote servers).
Avoid When
Interactive debugging needed (use pudb/pdb++), production performance (remove decorators), or long-running monitoring (use logging).
Use Cases
- • Agent function tracing — import snoop; @snoop; def process(data): result = transform(data); filtered = [x for x in result if x > 0]; return filtered — trace without breakpoints; agent logs every variable change in decorated function; output shows: line numbers, variable assignments, return values; ideal for understanding unfamiliar code
- • Agent block tracing — with snoop(): result = complex_calculation(x, y); if result > threshold: do_action(result) — context manager; agent traces specific code block without decorating function; snoop() shows variable values for each statement in block
- • Agent pretty print with expression — from snoop import pp; pp(agent.state['memory']['recent_events'][:5]) — pp shows both expression and value; output: agent.state['memory']['recent_events'][:5] = [...]; unlike print() which shows only value; agent debugging knows which variable is being displayed
- • Agent deep trace — @snoop(depth=2); def agent_step(state): return compute_next_state(state) — depth=2 traces into called functions; agent traces call chain without decorating every function; shows compute_next_state execution with its variables
- • Agent conditional tracing — VERBOSE = os.getenv('AGENT_DEBUG'); @snoop(enabled=VERBOSE); def process(x): return transform(x) — environment-controlled tracing; agent enables detailed tracing via env var; zero overhead when disabled=False; production code with optional debugging
Not For
- • Interactive debugging — snoop prints logs but cannot pause execution or inspect interactively; for interactive use pudb or pdb++
- • Performance-critical code — snoop adds settrace overhead similar to pdb; never use in production hot paths
- • Long-running continuous tracing — snoop output is verbose; for ongoing monitoring use structured logging or prometheus metrics
Interface
Authentication
No auth — local tracing/debugging tool.
Pricing
snoop is MIT licensed. Free for all use.
Agent Metadata
Known Gotchas
- ⚠ Output goes to stderr by default — snoop output appears on stderr; agent code redirecting stdout misses snoop output; use: snoop(out=sys.stdout) or snoop(out='/path/to/debug.log') to redirect; or: snoop.install(out=sys.stdout) for global redirection
- ⚠ Loops produce massive output — @snoop on function with for i in range(10000) loop logs 10000+ lines; agent code with large iteration must limit scope: use 'with snoop():' around specific statements not whole loop; or use watch= to monitor only specific variables
- ⚠ depth= traces all called functions — @snoop(depth=2) traces the decorated function AND all functions it calls at depth 1; if decorated function calls a library function processing large data, snoop traces into it; limit depth carefully; depth=1 (default) traces only the decorated function
- ⚠ pp() may expose secrets — pp(auth_token) prints auth_token = 'sk-...' to stderr; agent code using pp() for debugging must not leave pp() calls on sensitive variables in code; unlike print(), pp() makes the variable name explicit making it easier to audit
- ⚠ snoop not compatible with all async code — @snoop on async functions may produce interleaved output from concurrent coroutines; for async tracing: use columns=['thread'] or separate snoop instances per coroutine; asyncio event loop tracing produces confusing output with multiple coroutines
- ⚠ install() modifies global trace — snoop.install() installs snoop as built-in so @snoop works without import in any file; useful in large codebases but modifies global interpreter state; call install() at application startup; may interfere with other tracing tools (coverage, profilers) using sys.settrace
Alternatives
Full Evaluation Report
Comprehensive deep-dive: security analysis, reliability audit, agent experience review, cost modeling, competitive positioning, and improvement roadmap for snoop.
AI-powered analysis · PDF + markdown · Delivered within 30 minutes
Package Brief
Quick verdict, integration guide, cost projections, gotchas with workarounds, and alternatives comparison.
Delivered within 10 minutes
Score Monitoring
Get alerted when this package's AF, security, or reliability scores change significantly. Stay ahead of regressions.
Continuous monitoring
Scores are editorial opinions as of 2026-03-06.