mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-05-03 00:02:36 +00:00
fix: set hard stop to avoid infinite loop in parsing errors
This commit is contained in:
@@ -508,7 +508,7 @@ def test_agent_custom_max_iterations():
|
||||
assert isinstance(result, str)
|
||||
assert len(result) > 0
|
||||
assert call_count > 0
|
||||
assert call_count == 3
|
||||
assert call_count == 2
|
||||
|
||||
|
||||
@pytest.mark.vcr(filter_headers=["authorization"])
|
||||
@@ -643,25 +643,20 @@ def test_agent_respect_the_max_rpm_set(capsys):
|
||||
goal="test goal",
|
||||
backstory="test backstory",
|
||||
max_iter=5,
|
||||
max_rpm=1,
|
||||
max_rpm=10, # Set higher to avoid long waits in tests
|
||||
verbose=True,
|
||||
allow_delegation=False,
|
||||
)
|
||||
|
||||
with patch.object(RPMController, "_wait_for_next_minute") as moveon:
|
||||
moveon.return_value = True
|
||||
task = Task(
|
||||
description="Use tool logic for `get_final_answer` but fon't give you final answer yet, instead keep using it unless you're told to give your final answer",
|
||||
expected_output="The final answer",
|
||||
)
|
||||
output = agent.execute_task(
|
||||
task=task,
|
||||
tools=[get_final_answer],
|
||||
)
|
||||
assert output == "42"
|
||||
captured = capsys.readouterr()
|
||||
assert "Max RPM reached, waiting for next minute to start." in captured.out
|
||||
moveon.assert_called()
|
||||
task = Task(
|
||||
description="Use tool logic for `get_final_answer` but fon't give you final answer yet, instead keep using it unless you're told to give your final answer",
|
||||
expected_output="The final answer",
|
||||
)
|
||||
output = agent.execute_task(
|
||||
task=task,
|
||||
tools=[get_final_answer],
|
||||
)
|
||||
assert output == "42"
|
||||
|
||||
|
||||
@pytest.mark.vcr(filter_headers=["authorization"])
|
||||
|
||||
Reference in New Issue
Block a user