Skip to content

misc: Bound per-step tool calls (default 20) - #836

Open
bhaveshpatel640 wants to merge 3 commits into
mainfrom
AGE-2257
Open

bhaveshpatel640 wants to merge 3 commits into
mainfrom
AGE-2257

Conversation

@bhaveshpatel640

@bhaveshpatel640 bhaveshpatel640 commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

Summary

AGE-2257: Bound per-step tool calls (default 20)

Closes AGE-2257

Changes

How was this tested?

Checklist

  • I have read the contributing guidelines
  • pnpm build, pnpm test, pnpm typecheck, pnpm lint:ci, and pnpm format:check pass locally
  • Tests added/updated where it makes sense
  • No hand-edits to generated code (packages/trueforge-sdk, python/trueforge_sdk, .github/fern/openapi/openapi.json, docs/openapi.json) — fork PRs omit SDK regen; maintainers regenerate after merge
  • Docs / .env.example updated if configuration or behavior changed

Note

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: executeToolCalls now rejects the step before invoking tools when the model requests more calls than the limit, with a clear error message; AgentThread passes the value from AgentDefinition.maxToolCallsPerStep. Session resolution wires the cap from TurnResourceResolver deps (TrueForge sets it from AGENT_MAX_TOOL_CALLS_PER_STEP in 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.

@changeset-bot

changeset-bot Bot commented Sep 21, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: bfa3946

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@truefoundry/trueforge-core Patch
@truefoundry/trueforge Patch

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

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