crewAI
crewAI copied to clipboard
SelfImprovingFlow: hardcoded and content selected by string length — metrics are meaningless
Description
In SelfImprovingFlow, the self-improvement module has two issues:
- Score is hardcoded to
0.5instead of being extracted from the LLM response. No real evaluation logic exists. - Content selection uses
max(..., key=len)— picks the longest string, not the semantically best option.
Code pattern
# Score is always 0.5 regardless of quality
score = 0.5
# Picks the longest mutation, not the best one
best_content = max(mutations, key=len)
This means:
- Self-improvement metrics are meaningless for any downstream use (comparison, plotting, decision-making)
- Content "improvement" just returns the longest output, which is often verbose/low-quality
Expected
- Score should be extracted from the LLM response when the model returns a structured evaluation (or via a separate scoring call)
- Content selection should use a quality heuristic or the actual evaluation score, not string length
- If scoring cannot be done, the score field should be omitted rather than hardcoded
Environment
- CrewAI: 1.15.5
- Python: 3.11
Closed — configuration/customization issue, not a core framework bug.