You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When max_iterations is set to 1, the ReActAgent should perform only one iteration and then stop. If it's entering an infinite loop, it might be due to the agent not correctly identifying when a response is complete. The agent should break out of the loop if it determines it cannot answer the question with the provided tools [1][2].
Ensure that the logic for determining a complete response is correctly implemented. If the agent is not following the expected behavior, it might be a bug in version 0.11.14. You may want to check if the handle_reasoning_failure_fn is correctly handling failures, as it can prevent infinite loops by managing reasoning failures [3].
_get_response function in ReActAgentWorker is checking iterations. In current situation, But if current_reasoning starts from 2 and max_iterations is 1, then ReAct agent will be stuck in infinite loop.
So my suggestion is to modify operator == to > when comparing len(current_reasoning) and max_iterations like below.
def_get_response(
self,
current_reasoning: List[BaseReasoningStep],
sources: List[ToolOutput],
) ->AgentChatResponse:
"""Get response from reasoning steps."""iflen(current_reasoning) ==0:
raiseValueError("No reasoning steps were taken.")
eliflen(current_reasoning) >self._max_iterations:
raiseValueError("Reached max iterations.")
Bug Description
When I set max_iterations to 1, my ReAct Agent stuck in infinite loop.
Version
0.11.14
Steps to Reproduce
Set query that agent can't find information from tool.
Relevant Logs/Tracbacks
No response
The text was updated successfully, but these errors were encountered: