Debug Your AI Agents Like Code
Pause at breakpoints, inspect state, modify variables, and explore "what if" scenarios. Just like debugging regular code, but for AI agents.
Feature Status (v0.3.2 - Updated Oct 20, 2025)
Most Important: Use arrow keys to navigate menus, or press c to continue. That's all you need to know to start!
60-Second Quick Start
Add @xray to tools you want to inspect, then call agent.auto_debug():
The Interactive Menu
At every @xray breakpoint, you see this menu:
What do you want to do?
โ Continue execution ๐ [c or Enter]
Edit values ๐ [e]
Quit debugging ๐ซ [q]
๐ก Coming soon (by Nov 2): Ask AI [a], View trace [v], Step mode [s]
>Method 1: Arrow Keys (Beginner-friendly)
- โ โMove selection up and down
- EnterSelect highlighted option
Method 2: Shortcuts (Power user)
cContinue executioneEdit variablesqQuit debugging
Both methods do exactly the same thing - use whichever feels natural!
Available Features
Continue Execution
โ AvailableThe most common action - just press c or Enter to continue:
Edit Variables (Python REPL)
โ AvailableModify variables to test "what if" scenarios. This is a full Python REPL with access to all variables:
Test any scenario: Empty results, large datasets, error cases, edge cases - just modify the variables and see how your agent handles it!
Ask AI for Help
๐ง Coming Nov 2Get context-aware help from AI about what's happening. The AI knows your code, execution state, and history:
> a โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ AI Help Mode - Ask questions about execution โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ ai> why did it only find 1 email? ๐ค AI: The search used query="John" which is broad. The API might be limiting results, or there's actually only 1 email from someone named John. You can test with modified results to see how the agent handles multiple emails. ai> how can I test with more emails? ๐ค AI: Switch to Python mode and modify: result = ["email1@ex.com", "email2@ex.com", "email3@ex.com"] ai> /menu [Back to menu] ai> /continue [Resume execution]
View Execution Trace
๐ง Coming Nov 2See the complete execution history with timeline, messages, and agent state:
Timeline: [0] user_input: "Send email to John" [1] llm_call: 234ms โ 2 tool calls requested [2] tool: search_emails โ 123ms โ YOU ARE HERE [3] (pending) tool: send_email Total: 323ms โข 2 steps โข 1 iteration
Toggle Step Mode
๐ง Coming Nov 2Pause at EVERY tool, not just @xray tools:
Press s in menu to enable:
โ Step mode enabled - will pause at EVERY tool โ Tool: validate_input(...) [No @xray, but pauses!] โ Result: Valid [BREAKPOINT] โ Tool: fetch_data(...) โ Result: 50 records [BREAKPOINT]
Complete User Journey
Let's walk through a full debugging session:
Best Practices
1. Strategic @xray Placement
Add @xray to:
- API calls and database operations
- Complex business logic
- Tools that often fail or have important side effects
Skip simple utilities and pure functions. Or use step mode to see everything!
2. Test Edge Cases in Python Mode
Time-travel debugging: Change one variable, see entire agent behavior change.
3. Use Step Mode for Complex Workflows
When you don't know which tool is causing problems:
When to Use
Perfect For
- โDevelopment - Building and testing agents
- โDebugging - Finding unexpected behavior
- โLearning - Understanding agent decisions
- โTesting edge cases - "What if" scenarios
- โPrompt engineering - Discover what works
Not For
- โProduction - Requires human interaction
- โAutomated tests - Use assertions instead
- โCI/CD pipelines - Not non-interactive
- โSimple scripts - Overkill for basic tasks
Frequently Asked Questions
How do I continue execution?
Press 'c' or Enter from the menu, or type '/continue' from any mode.
What's the difference between @xray and step mode?
@xray breakpoints pause only at marked tools (selective). Step mode pauses at EVERY tool (comprehensive).
Can I still use agent.input() directly?
Yes - .auto_debug() is optional. Use it only when you need interactive debugging.
Is this slow?
No - execution speed is the same. Pausing only happens at breakpoints.
Works in Jupyter notebooks?
Yes! Works in any Python environment with terminal support.
Ready to Debug Like a Pro?
Just call agent.auto_debug() and explore!
The tips will guide you through - no memorization needed. ๐
