Interactive Debugging
Debug your AI agents like code. Pause at breakpoints, inspect state, modify variables, and explore 'what if' scenarios.
Feature Status — v0.3.2+
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. 🔍
ConnectOnion