Repository navigation
feat(agent-service): lower the default step limit to 25 and cap it at 50 - #9603
Merged
Merged
Conversation
Contributor
Automated Reviewer SuggestionsBased on the
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #9603 +/- ##
=========================================
Coverage 91.68% 91.68%
Complexity 5125 5125
=========================================
Files 1305 1305
Lines 58211 58222 +11
Branches 7594 7594
=========================================
+ Hits 53371 53382 +11
Misses 2933 2933
Partials 1907 1907
*This pull request uses carry forward flags. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Contributor
Author
|
@sshiv012 could you take a look? This is part of #9576: it lowers the agent's default step limit from 100 to 25. Also I request @parshimers 's review as you are at |
sshiv012
suggested changes
Nov 23, 2026
An agent turn could make up to 100 model calls by default, and a looping agent stops only at that limit. Measured real turns take a median of 3 calls and at most 13, so 25 leaves room for every one of them, cuts a runaway turn to a quarter, and fits the 1-50 range the settings dialog accepts.
bobbai00
force-pushed
the
feat/agent-default-step-limit
branch
from
November 24, 2026 06:54
6caa40c to
2d743c9
Compare
The settings dialog stops at 50 steps per message, but the agent service accepted any limit of 1 or more, so a request sent straight to the API could let a looping agent make far more model calls. Both routes that take a step limit, creating an agent and saving its settings, now refuse anything above 50 with a 400.
kunwp1
approved these changes
Nov 24, 2026
kunwp1
left a comment
Contributor
There was a problem hiding this comment.
LGTM! One optional comment below
The default step limit test built its own looping model. It now uses the one the step limit notice tests share, which gives up after 50 calls instead of 20 so the default of 25 fits, and it also checks that the turn ends with the notice that tells the user why it stopped.
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 changes were proposed in this PR?
Lowers the agent's default limit on model calls (steps) per message from 100 to 25 (
maxStepsinagent-service/src/types/agent.ts). It also caps the limit at 50, the settings dialog's maximum, so a request sent straight to the API can no longer go past it (agent-service/src/server.ts). A looping agent stops only at this limit, so a runaway turn now costs a quarter of the calls. 25 is about twice the largest of 60 measured turns (13 model calls, median 3), so ordinary turns are not cut. Users can still raise it per agent in the settings, up to 50.Any related issues, documentation, discussions?
Closes #9602
Part of #9576
How was this PR tested?
bun testinagent-service. A new test drives a model that never stops calling tools, without settingmaxSteps, and expects the turn to stop after 25 calls. Two route tests send a limit of 51: the creation test expects a 400 and no new agent, and the settings test expects a 400 and an unchanged limit. Both accept 50. All three fail onmain.Was this PR authored or co-authored using generative AI tooling?
Generated-by: Claude Code (Claude Fable 5.2, Claude Opus 5.5)