misc: Bound per-step tool calls (default 20) - #836
Open
bhaveshpatel640 wants to merge 3 commits into
Open
bhaveshpatel640 wants to merge 3 commits into
bhaveshpatel640 wants to merge 3 commits into
Conversation
bhaveshpatel640
requested review from
chiragjn,
debajyoti-truefoundry,
heerambavi1998,
sr07asthana and
thesujai
as code owners
September 21, 2026 17:26
🦋 Changeset detectedLatest commit: bfa3946 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
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.
Summary
AGE-2257: Bound per-step tool calls (default 20)
Closes AGE-2257
Changes
How was this tested?
Checklist
pnpm build,pnpm test,pnpm typecheck,pnpm lint:ci, andpnpm format:checkpass locallypackages/trueforge-sdk,python/trueforge_sdk,.github/fern/openapi/openapi.json,docs/openapi.json) — fork PRs omit SDK regen; maintainers regenerate after merge.env.exampleupdated if configuration or behavior changedNote
Medium Risk
Changes agent execution semantics: turns that previously allowed unbounded parallel tool calls will now fail when the model exceeds the cap, though the default is tunable via env.
Overview
Adds a host-configurable ceiling on how many tool calls can run in a single assistant step, default 20 (
DEFAULT_MAX_TOOL_CALLS_PER_STEP), to limit worst-case memory when many MCP responses run in parallel alongside the existing 50MB per-response cap.Runtime behavior:
executeToolCallsnow rejects the step before invoking tools when the model requests more calls than the limit, with a clear error message;AgentThreadpasses the value fromAgentDefinition.maxToolCallsPerStep. Session resolution wires the cap fromTurnResourceResolverdeps (TrueForge sets it fromAGENT_MAX_TOOL_CALLS_PER_STEPin config /.env.example). The constant is exported from@truefoundry/trueforge-core.Tests cover over-limit vs in-limit execution; OpenAPI/docs version bumps to 0.2.1 with a changeset for patch releases.
Reviewed by Cursor Bugbot for commit bfa3946. Bugbot is set up for automated code reviews on this repo. Configure here.