Make max_tool_steps configurable, and actually wire it up - #29
Merged
Conversation
The tool-calling loop in openai_agent.py ran on the hardcoded
MAX_TOOL_STEPS = 20. That is enough for a report-writing subtask and not
for one that has to extract, compile and then summarise: such an item hit
the cap repeatedly, each time doing most of the work and returning no
answer at all.
max_tool_steps is now a scalar key at [harness], inside a stage table and
inside a profile, resolved like every other. Two details that made the
first cut of this silently ineffective:
- _build() has to pass max_tool_steps into the top-level HarnessConfig.
The key already passed the _HARNESS_SCALAR_KEYS check, so omitting it
there raised no error; the field stayed None and the loop fell back to
20, producing runs that reported a cap of 20 while the file said 35 --
exactly the silent misconfiguration that key check exists to prevent.
- _finalise() has to coerce it to int. _scalar() stringifies every value
during layering, so a per-stage max_tool_steps arrived as "35" and
range("35") raises TypeError. max_tokens was already coerced; the loop
now covers both integer keys.
The step-cap error message also names the setting and the alternative
(split the subtask), since the number in it is now configurable.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01S7Y1ASxt4ox8riauVcYCsF
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this changes
The tool-calling loop in openai_agent.py ran on the hardcoded MAX_TOOL_STEPS = 20. That is enough for a report-writing subtask and not for one that has to extract, compile and then summarise: such an item hit the cap repeatedly, each time doing most of the work and returning no answer at all.
max_tool_steps is now a scalar key at [harness], inside a stage table and inside a profile, resolved like every other. Two details that made the first cut of this silently ineffective:
_build() has to pass max_tool_steps into the top-level HarnessConfig. The key already passed the _HARNESS_SCALAR_KEYS check, so omitting it there raised no error; the field stayed None and the loop fell back to 20, producing runs that reported a cap of 20 while the file said 35 -- exactly the silent misconfiguration that key check exists to prevent.
_finalise() has to coerce it to int. _scalar() stringifies every value during layering, so a per-stage max_tool_steps arrived as "35" and range("35") raises TypeError. max_tokens was already coerced; the loop now covers both integer keys.
The step-cap error message also names the setting and the alternative (split the subtask), since the number in it is now configurable.
Checklist
make checkis green locallyare the product)
specs/(spec changes go through an issue first)Generated-by:trailer present if anagent wrote the change