Repository navigation
Replies: 1 comment 1 reply
|
Great question! Here are solutions to prevent infinite tool loops:
call_count = {}
def my_tool():
call_count[key] = call_count.get(key, 0) + 1
if call_count[key] > 5:
return "Stop: max iterations reached"
We faced similar issues in our OpenClaw projects - the key is combining both config limits and tool-level safeguards! |
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
I have a custom agent that calls an external API tool, but sometimes it
gets stuck in a loop calling the same tool 10–15 times before finishing.
My setup:
All reactions