Debugging Techniques
Master systematic debugging approaches using execution logs and AI troubleshooting tools.
Overview
When agents don't behave as expected, systematic debugging helps you identify and fix issues quickly. ExecAssist provides detailed execution logs and AI-powered analysis to streamline troubleshooting.
The Debugging Process
Step 1: Identify the Problem
Start by clearly defining what's wrong:
- What did you expect to happen?
- What actually happened?
- When did it start occurring?
- Does it happen consistently or intermittently?
Step 2: Gather Evidence
Collect relevant information:
- Execution ID - Specific execution that shows the issue
- Time range - When did the problem occur?
- Affected agent - Which agent is misbehaving?
- Email details - What triggered the execution?
Step 3: Analyze Execution Details
Examine the execution log thoroughly:
- Input (the email)
- Agent reasoning
- Tool calls and results
- Final output or error
Step 4: Form a Hypothesis
Based on evidence, propose what's causing the issue:
- Instruction problem?
- Missing tool?
- Wrong data?
- External service issue?
Step 5: Test and Verify
- Make a targeted change
- Test with similar input
- Verify the fix
- Monitor for recurrence
Using Execution Details
Navigating to Execution Details
- Go to Operations > Activity > Agent Executions
- Find the problematic execution
- Click to open details
Understanding the Execution View
Header Section
- Status - Success, Failed, or In Progress
- Duration - How long the execution took
- Tokens - Input and output token counts
- Cost - Calculated cost for this execution
Timeline View
Shows the sequence of events:
- Email Received - Original email content
- Agent Reasoning - LLM's thinking process
- Tool Calls - Each tool invocation with parameters and results
- Response Generated - Final output
Request/Response Details
- Full prompt - Complete input sent to LLM
- Raw response - Exact LLM output
- Error details - If execution failed
Key Things to Look For
In Agent Reasoning
- Is the agent understanding the email correctly?
- Is it making appropriate decisions?
- Does the reasoning align with instructions?
In Tool Calls
- Are the right tools being called?
- Are parameters correct?
- Are results being used appropriately?
In the Response
- Does the output match expectations?
- Are there obvious errors?
- Is the format correct?
AI-Powered Troubleshooting
Using the Troubleshoot Feature
ExecAssist includes AI-powered analysis for failed or problematic executions:
- Open an execution with issues
- Click Troubleshoot with AI
- Review the analysis
- Follow suggested fixes
What AI Analysis Provides
- Root cause identification - Why the execution failed
- Instruction suggestions - How to improve agent instructions
- Tool recommendations - Which tools might help
- Similar issues - Patterns from other executions
When to Use AI Troubleshooting
- Execution failed with an error
- Agent made obviously wrong decisions
- Response quality is poor
- You're unsure what's wrong
Common Debugging Scenarios
Scenario: Agent Ignores Important Information
Symptoms: Agent response doesn't reference key email content
Debugging steps:
- Check if the information appears in the prompt
- Review agent reasoning for any mention
- Check if instructions tell agent to look for this info
- Test with explicit instructions about this information
Likely fixes:
- Add explicit instructions about what to look for
- Provide examples of desired behavior
- Highlight important email elements in instructions
Scenario: Wrong Tool Called
Symptoms: Agent calls search when it should reply, or vice versa
Debugging steps:
- Review which tool was called and why
- Check agent reasoning for decision-making
- Compare to instructions about tool usage
- Test instructions about when to use each tool
Likely fixes:
- Clarify tool usage conditions in instructions
- Add decision criteria for tool selection
- Provide examples of correct tool usage
Scenario: Tool Returns Error
Symptoms: Tool call fails with an error message
Debugging steps:
- Check the error message in tool result
- Review parameters passed to the tool
- Test the tool manually if possible
- Check external service status
Likely fixes:
- Fix tool configuration
- Adjust how agent formats parameters
- Handle tool errors in instructions
Scenario: Response Too Long/Short
Symptoms: Responses are consistently wrong length
Debugging steps:
- Review response length in execution
- Check token counts
- Review length guidance in instructions
- Check max_tokens setting
Likely fixes:
- Add explicit length guidance in instructions
- Adjust max_tokens parameter
- Provide example responses of correct length
Scenario: Inconsistent Behavior
Symptoms: Same input produces different outputs
Debugging steps:
- Compare multiple executions with similar input
- Check temperature setting
- Review if context differs between executions
- Look for external factors (time, VIP status, etc.)
Likely fixes:
- Lower temperature for more consistency
- Clarify ambiguous instructions
- Add more specific decision criteria
Debugging Tools and Techniques
Comparing Executions
- Open two execution tabs side by side
- Compare inputs - Are they really the same?
- Compare reasoning - Where do decisions diverge?
- Compare outputs - What's different?
Testing Instruction Changes
- Edit agent instructions
- Save changes
- Send test email
- Compare new execution to old
- Iterate until fixed
Using Filters Effectively
In the Executions list, use filters to find patterns:
- By status - Find all failures
- By agent - Focus on one agent
- By date - Narrow to problem timeframe
- By duration - Find unusually slow executions
Examining Raw Data
For deep debugging:
- View the raw request JSON
- Check exact prompt format
- Review raw response
- Look for unexpected content
Debugging Checklist
Use this checklist when debugging:
- Identified specific execution with issue
- Reviewed execution timeline
- Checked email input for issues
- Reviewed agent reasoning
- Verified correct tools were called
- Checked tool results for errors
- Compared to expected behavior
- Identified likely root cause
- Made targeted fix
- Verified fix with test execution
Prevention: Writing Debuggable Instructions
Make future debugging easier:
Be Explicit About Decisions
When deciding whether to escalate:
- IF the customer mentions "lawyer" or "legal", escalate immediately
- IF the issue involves money over $500, escalate
- IF you cannot find an answer in 2 searches, escalate
- OTHERWISE, continue handling normally
Include Reasoning Requests
Before responding, briefly explain your reasoning:
1. What is the customer asking for?
2. What information do I need?
3. Can I resolve this, or should I escalate?
Then proceed with your response.
Add Logging Points
When searching the knowledge base:
- Note what you're searching for and why
- If no results, try an alternative query
- If still no results, note this and proceed with available info
When to Escalate
Contact support when:
- Same error persists across many executions
- Issue started after a system update
- Error messages reference system components
- You've tried all relevant debugging steps
- Issue affects multiple agents or mailboxes
Provide:
- Execution IDs showing the issue
- Steps you've tried
- Time when issue started
- Any recent changes made