dspy/unbounded-react-iters
| Pack | Severity | Fix | Versions |
|---|---|---|---|
| DSPy | warning | none, edit by hand | All versions |
dspy.ReAct(...) defaults to max_iters=20, allowing runaway tool loops to burn latency and tokens when an explicit iteration cap is not set.
agent = dspy.ReAct("question -> answer", tools=[search_tool])agent = dspy.ReAct("question -> answer", tools=[search_tool], max_iters=6)What the rule reports
Section titled “What the rule reports”Calls to dspy.ReAct(...) or ReAct(...) that omit max_iters=... (excluding calls forwarding **kwargs).
How to fix it
Section titled “How to fix it”Pass an explicit max_iters=... limit matched to the task's tool budget.
Diagnostic message
Section titled “Diagnostic message”dspy.ReAct(...) without an explicit max_iters relies on the default of 20 tool iterations. Set max_iters=... explicitly to bound latency and token spend.See all rules in the DSPy pack.