Heuristic:ARCANGEL0 EVA Tool Call Budget Limit
| Knowledge Sources | |
|---|---|
| Domains | LLMs, Optimization, Safety |
| Last Updated | 2026-10-29 12:00 GMT |
Overview
Cap tool calls at 48 per agent turn to prevent runaway agent loops and control API cost.
Description
Mitsu enforces a hard limit of 48 tool calls per single agent turn (`MAX_TOOL_CALLS_PER_TURN`). Once this limit is reached, the agent is instructed to summarize results and pause, no further tools are dispatched, and any pending tool calls are finished with a "Not run" message. This prevents infinite tool-call loops where the model keeps calling tools without converging on an answer, which would consume API tokens and potentially cause unintended side effects on the target.
Usage
Apply this heuristic in all agent modes (Recon, Guided, AutoPwn). When the tool call budget is exhausted, the system prompt is augmented with "This turn's action limit is reached. Summarize the results and pause." and the agent yields a `limit` event followed by `done`.
The Insight (Rule of Thumb)
- Action: Enforce `MAX_TOOL_CALLS_PER_TURN = 48` as a hard ceiling.
- Value: 48 tool calls per turn (not configurable at runtime).
- Trade-off: Complex investigations may require multiple turns to complete, but this prevents runaway loops.
- Compatibility: Applies to all modes. Guided mode further restricts to one investigation action per step.
Reasoning
Without a tool call budget, an agent can enter an infinite loop of tool calls — repeatedly running the same command with slight variations, or chaining tools without converging. The 48-call limit is generous enough for most investigation steps (e.g., enumerate ports, identify services, research vulnerabilities) while providing a firm safety boundary. When the limit is hit, finishing pending tools with "Not run" messages keeps the conversation history valid so the model can summarize properly.
Code Evidence
Constant from `agents/runtime.py:28`:
MAX_TOOL_CALLS_PER_TURN = 48
Budget enforcement from `agents/runtime.py:281-286`:
action_budget_exhausted = tool_calls_this_turn >= MAX_TOOL_CALLS_PER_TURN
if action_budget_exhausted:
active_system_prompt += "\n\nThis turn's action limit is reached. Summarize the results and pause."
available_tools = tool_host.provider_tools(active_mode)
tools = [] if action_budget_exhausted else available_tools
Limit-reached handling from `agents/runtime.py:348-353`:
if action_budget_exhausted:
finish_interrupted_tools(history, "Not run: this turn's action limit was reached.")
on_history()
yield AgentEvent("limit", {"message": "Action limit reached. Mitsu is paused."})
yield AgentEvent("done", {})
return