Agent Configuration
This page provides detailed documentation for all agent configuration parameters, including execution controls, context management, and output formatting options.Core Parameters
Execution Control Parameters
max_iter
- Type:
int - Default:
15 - Description: Maximum number of iterations an agent will attempt to complete a task
- Range: 1-100 (recommended: 10-25)
max_iter parameter controls how many times an agent can iterate through its execution loop when working on a task. This prevents infinite loops and ensures tasks complete within reasonable bounds.
- Set lower values (5-10) for simple tasks
- Use higher values (20-30) for complex research or analysis tasks
- Monitor iteration count to optimize performance
max_retry_limit
- Type:
int - Default:
2 - Description: Maximum number of times to retry a failed operation
- Range: 0-10 (recommended: 2-5)
- API calls that may face rate limits
- Network operations that may timeout
- Tool executions that may fail intermittently
Context Management
context_length
- Type:
int - Default:
None(uses model default) - Description: Maximum context window size in tokens
- Common Values:
- GPT-4: 128000
- GPT-3.5: 16385
- Claude 3: 200000
- Larger context windows allow more information but increase costs
- Some models perform better with focused context
- Always validate against your LLM’s maximum context size
Output Formatting
markdown
- Type:
bool - Default:
True - Description: Enable markdown formatting in agent outputs
- Headers using
#,##, etc. - Bold text with
**text** - Code blocks with
``` - Lists and tables
- Links and images
Advanced Execution Controls
Performance Optimization
Error Handling Configuration
Configuration Patterns
Research Agent Configuration
Quick Task Agent Configuration
Environment Variable Overrides
Agent parameters can be overridden using environment variables:Validation and Constraints
Parameter Validation Rules
| Parameter | Validation | Error Handling |
|---|---|---|
max_iter | Must be > 0 | Defaults to 15 if invalid |
max_retry_limit | Must be >= 0 | Defaults to 2 if invalid |
context_length | Must be greater than 0 and less than or equal to model max | Uses model default if invalid |
markdown | Must be boolean | Defaults to True if invalid |
Interaction Between Parameters
-
Context Length and Max Iterations
- Higher
max_itermay require largercontext_length - Each iteration adds to context usage
- Higher
-
Retry Limit and Execution Time
- Higher
max_retry_limitextends total execution time - Consider both when setting timeouts
- Higher
-
Markdown and Response Templates
markdown=Trueenables template formatting- Templates should use markdown syntax when enabled
Troubleshooting
Common Issues
-
Agent exceeds iteration limit
-
Context window exceeded
-
Frequent retry failures
See Also
- Task Configuration - Configure task execution
- LLM Configuration - LLM-specific settings
- Best Practices - Configuration guidelines

