-
Notifications
You must be signed in to change notification settings - Fork 2
fix: tool call counting #282
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR introduces a new max_tool_calls configuration option for the Agent class to limit the number of tool calls an agent can make during execution. The feature includes proper error handling and reporting through a new stop reason and exception type.
- Added
max_tool_callsattribute to the Agent class (defaults to -1 for unlimited) - Implemented tool call counting and limit enforcement in the agent's execution loop
- Created
MaxToolCallsErrorexception andmax_tool_calls_reachedstop reason for proper error reporting
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| dreadnode/agent/result.py | Added max_tool_calls_reached to the AgentStopReason literal type |
| dreadnode/agent/error.py | Introduced new MaxToolCallsError exception class for handling max tool call limit violations |
| dreadnode/agent/agent.py | Added max_tool_calls config option, tool call counter, and enforcement logic in the execution loop |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…all that is past max
Summary
max_tool_callsconfig option to limit the number of tool calls an agent can make (defaults to-1for unlimited)Finishwhen limit is reachedmax_tool_calls_reachedstop reason andMaxToolCallsErrorfor proper error reportingGenerated Summary:
max_tool_callsattribute to specify the maximum allowed tool calls during execution, defaulting to infinite.MaxToolCallsErrorwhen the limit is reached.AgentStopReasontype reflects the new possible state ofmax_tool_calls_reached.This summary was generated with ❤️ by rigging