Debugging tips
- Check session events: Session errors are conveyed through the
session.errorevent - Review tool results: Tool execution failures often explain unexpected agent behavior
- Track token usage: Monitor token consumption to optimize prompts and reduce costs
- Use system prompts: Add logging instructions to the system prompt to make the agent explain its reasoning
- Troubleshoot previews: If a stream that opts in to event deltas doesn't behave as you expect, see Troubleshoot previews