Debug Mode
Enable debug mode to see the messages sent to the model, tool calls, delegation patterns, and metrics.
Set
debug_level=2 for more detailed logs:
What to Look For
When debugging, check:Common Failure Modes
Leader Delegates to Wrong Member
The leader picks members based on theirrole. If delegation is wrong:
- Check that roles clearly describe what each member does
- Make roles distinct (avoid overlap)
- Add instructions to the team leader
Member Fails Silently
If a member fails, the leader may synthesize a response without that member’s output. Passshow_member_responses=True to print_response() to see what each member returned:
Infinite Delegation Loop
The leader keeps delegating without producing a final response. This usually means:- Instructions are unclear about when to stop
- Members are returning incomplete results
High Token Usage
Teams make leader and member model calls. Token usage increases with the number of delegations, member responses, and synthesis calls. Check token usage in debug output or metrics:- Use fewer members
- Keep member responses concise
- Use
mode=TeamMode.route(orrespond_directly=True) to skip synthesis
Interactive CLI
Test multi-turn conversations with the built-in CLI:await team.acli_app() for async.
Tracing with AgentOS
For production debugging, enable tracing and inspect traces in AgentOS:- Visual trace of all delegation and tool calls
- Token usage breakdown by member
- Session history
- Error tracking