Skip to content

Agent: no default tool-round cap; announce AGENT_MAX_TOOL_STEPS when set - #216

Merged
bararchy merged 1 commit into
masterfrom
fix/agent-no-tool-cap
Nov 22, 2026
Merged

bararchy merged 1 commit into
masterfrom
fix/agent-no-tool-cap

Conversation

@bararchy

Copy link
Copy Markdown
Member

Problem

The agent capped every request at 40 tool rounds while its system prompt says there is no tool-call limit. A sub-agent doing real investigation (distinct greps and reads, ~59K tokens) was cut off at round 40, and the model only learned about the cap when it hit it.

Fix

  • No cap by default. Runaways are still caught: the repeated-identical-call guard (REPEAT_CALL_LIMIT), the context window, and Ctrl-C / steering.
  • AGENT_MAX_TOOL_STEPS=N sets an optional cap. When set:
    • the system prompt states the cap instead of "no limit";
    • every tool result ends with [tool round i of N; k left for this request];
    • the last round still produces a final answer, as before.

Tests

Typecheck, format, Ameba clean; agent specs 39 examples, 0 failures.

@bararchy
bararchy merged commit 142d4eb into master Nov 22, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant