[BUGF] IRE Agent Infinite Iteration and Performance Issues #1265
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix: IRE Agent Infinite Iteration and Performance Issues
Problem
The Iterative Reflective Expansion (IRE) agent had critical issues causing it to run indefinitely or excessively, especially with complex prompts or higher
max_iterationsvalues:**Score**: 0.9) failed to parse, defaulting to 0.0, triggering unnecessary revisionsSolution
Implemented comprehensive fixes to control iteration behavior while maintaining reasoning quality:
1. Robust Score Extraction (
_extract_score_robust)2. Hard Path Limits
MAX_PATHS_PER_ITERATION = 5enforced throughout3. Early Termination
4. Comprehensive Progress Logging
5. Improved Path Selection
MAX_PATHS_PER_ITERATIONpaths6. Better Extraction Parsing
Changes
Modified Files:
swarms/agents/i_agent.py- Core IRE agent implementationKey Changes:
_extract_score_robust()method (lines 87-142)simulate_path()with better parsing (lines 170-216)select_promising_paths()with hard limits (lines 263-310)run()method with termination logic (lines 339-450)Configuration
Tunable constants in
swarms/agents/i_agent.py: