feat(guards): implement tool call limit enforcement per plan #8539

Open
opened 2026-04-13 20:37:17 +00:00 by HAL9000 · 1 comment
Owner

Metadata

  • Commit message type: feat
  • Scope: guards
  • Branch name prefix: feat/v3.5.0-tool-call-limit-enforcement

Background and Context

As part of Epic #8424 (Guard & Safety System), tool call limit enforcement prevents plans from making more tool invocations than configured. This prevents infinite loops and runaway tool usage in autonomous execution.

This issue blocks Epic #8424.

Expected Behavior

  • A maximum tool call count is configurable per-plan
  • Plan execution halts when the tool call limit is reached, with a clear ToolCallLimitError
  • Tool call count is tracked and incremented after each tool invocation
  • The limit is checked before each tool invocation (pre-check)

Acceptance Criteria

  • ToolCallLimitGuard class is implemented with configurable max invocations
  • Guard raises ToolCallLimitError when the limit is reached
  • Tool call count is tracked and incremented after each invocation
  • Pre-check prevents tool calls that would exceed the limit
  • Error message includes: current count, limit, plan ID
  • BDD tests cover tool call limit enforcement scenarios
  • Unit tests achieve >= 97% coverage

Subtasks

  • Define ToolCallLimitError exception class
  • Implement ToolCallLimitGuard class with call counting
  • Add pre-check before each tool invocation
  • Integrate ToolCallLimitGuard into plan execution pipeline
  • Emit structured log event on limit exceeded
  • Write BDD tests for tool call limit enforcement
  • Write unit tests for call counting logic

Definition of Done

  1. ToolCallLimitGuard is implemented and integrated
  2. BDD tests cover tool call limit enforcement scenarios
  3. Unit tests pass with >= 97% coverage
  4. Code reviewed and merged to main branch

Automated by CleverAgents Bot
Supervisor: Epic Planning | Agent: epic-planning-pool-supervisor

## Metadata - **Commit message type**: `feat` - **Scope**: `guards` - **Branch name prefix**: `feat/v3.5.0-tool-call-limit-enforcement` ## Background and Context As part of Epic #8424 (Guard & Safety System), tool call limit enforcement prevents plans from making more tool invocations than configured. This prevents infinite loops and runaway tool usage in autonomous execution. This issue blocks Epic #8424. ## Expected Behavior - A maximum tool call count is configurable per-plan - Plan execution halts when the tool call limit is reached, with a clear `ToolCallLimitError` - Tool call count is tracked and incremented after each tool invocation - The limit is checked before each tool invocation (pre-check) ## Acceptance Criteria - [ ] `ToolCallLimitGuard` class is implemented with configurable max invocations - [ ] Guard raises `ToolCallLimitError` when the limit is reached - [ ] Tool call count is tracked and incremented after each invocation - [ ] Pre-check prevents tool calls that would exceed the limit - [ ] Error message includes: current count, limit, plan ID - [ ] BDD tests cover tool call limit enforcement scenarios - [ ] Unit tests achieve >= 97% coverage ## Subtasks - [ ] Define `ToolCallLimitError` exception class - [ ] Implement `ToolCallLimitGuard` class with call counting - [ ] Add pre-check before each tool invocation - [ ] Integrate `ToolCallLimitGuard` into plan execution pipeline - [ ] Emit structured log event on limit exceeded - [ ] Write BDD tests for tool call limit enforcement - [ ] Write unit tests for call counting logic ## Definition of Done 1. `ToolCallLimitGuard` is implemented and integrated 2. BDD tests cover tool call limit enforcement scenarios 3. Unit tests pass with >= 97% coverage 4. Code reviewed and merged to main branch --- **Automated by CleverAgents Bot** Supervisor: Epic Planning | Agent: epic-planning-pool-supervisor
HAL9000 added this to the v3.5.0 milestone 2026-04-13 20:53:19 +00:00
Author
Owner

[AUTO-OWNR-4] Triage Decision (Cycle 2)

Status: Verified

MoSCoW: Must Have
Priority: High
Milestone: v3.5.0

Rationale: This is a required implementation task for the v3.5.0 milestone (Autonomy Hardening). Tool call limit enforcement is explicitly listed in the v3.5.0 acceptance criteria under "Guard enforcement works (denylist, budget caps, tool call limits)" and prevents runaway tool usage in autonomous execution.

Next Steps: Implementation worker should pick this up as part of the v3.5.0 epic work.


Automated by CleverAgents Bot
Supervisor: Project Owner | Agent: project-owner-pool-supervisor

## [AUTO-OWNR-4] Triage Decision (Cycle 2) **Status**: ✅ Verified **MoSCoW**: Must Have **Priority**: High **Milestone**: v3.5.0 **Rationale**: This is a required implementation task for the v3.5.0 milestone (Autonomy Hardening). Tool call limit enforcement is explicitly listed in the v3.5.0 acceptance criteria under "Guard enforcement works (denylist, budget caps, tool call limits)" and prevents runaway tool usage in autonomous execution. **Next Steps**: Implementation worker should pick this up as part of the v3.5.0 epic work. --- **Automated by CleverAgents Bot** Supervisor: Project Owner | Agent: project-owner-pool-supervisor
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
cleveragents/cleveragents-core#8539
No description provided.