Enabling Reflection
To enable reflection capabilities, setenable_thinking_tool=True
when creating your agent:
How Reflection Works
When reflection is enabled, the agent follows a structured “blueprint” approach:- Strategic Planning: The agent creates a complete, sequential plan of tool calls
- Automated Execution: An orchestrator executes the plan step-by-step
- Final Synthesis: The agent synthesizes results into a comprehensive answer
Reflection vs. Basic Mode
Feature | Basic Mode | Reflection Mode |
---|---|---|
Planning | Ad-hoc tool calls | Structured blueprint creation |
Execution | Direct tool execution | Orchestrated step-by-step execution |
Analysis | Immediate responses | Thoughtful synthesis of results |
Use Cases | Simple queries | Complex multi-step analysis |
Reflection Configuration
Agent-Level Reflection
Task-Level Reflection
Mixed Configuration
Reflection Use Cases
Reflection is ideal for:- Financial Analysis: Multi-step investment analysis and risk assessment
- Regulatory Compliance: Complex compliance checking and documentation
- Portfolio Management: Comprehensive portfolio analysis and recommendations
- Risk Assessment: Detailed risk evaluation across multiple factors
- Strategic Planning: Long-term financial planning and strategy development
Example: Financial Risk Analysis
Example: Banking Compliance Analysis
Reflection Output Structure
When reflection is enabled, the agent provides:- Strategic Analysis: Detailed reasoning about the problem
- Execution Plan: Step-by-step tool call sequence
- Risk Assessment: Identification of potential issues
- Final Synthesis: Comprehensive answer based on all gathered information
Example Reflection Flow
Performance Considerations
Important: Reflection capabilities consume more tokens and processing time than basic mode. Monitor your usage and costs when using reflection for production applications.Best Practices
- Use for Complex Tasks: Enable reflection for multi-step financial analysis
- Disable for Simple Queries: Use basic mode for straightforward questions
- Monitor Costs: Track token usage with reflection enabled
- Debug Mode: Use debug mode during development to understand the process
- Task-Specific Control: Override agent settings for specific tasks when needed
- Clear Instructions: Provide detailed, specific instructions for better planning
- Tool Availability: Ensure all required tools are available for the planned sequence