Skip to content

fix(server): leave the tool-call limit to the sandbox, keep a 256 backstop - #1560

Merged
Aditya-thesys merged 9 commits into
mainfrom
ap/server-tool-call-cap-48
Nov 9, 2026
Merged

Aditya-thesys merged 9 commits into
mainfrom
ap/server-tool-call-cap-48

Conversation

@Aditya-thesys

@Aditya-thesys Aditya-thesys commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

What it does better

  • Bring-your-own-library dashboards can make up to 48 tool calls per script run (was 16), so a dashboard that pages through Stripe, Postgres or GitHub loads instead of failing at the 17th call. In our benchmark, Sonnet 5.5 one-call generates went from 12/15 correct at 16 calls to 15/15 at 48; the misses were GitHub dashboards that need more calls.
  • A later change to the sandbox's limit needs no new release of this package and no app upgrade.

What

@openuidev/server's dashboard interpreter stopped a script run at 16 tool calls (packages/server/src/tools/execute.ts), before OpenUI Cloud's sandbox applied its own limit. The sandbox now allows 48 (sandbox-runner#13), and muse#653 tells the model 48.

Raising the number here to 48 would mean every later change to the sandbox's limit needs a release of this package and every app to upgrade. So this package no longer owns the limit:

  • Tool calls: the sandbox enforces the limit per run and fails the run itself: the developer sees code SCRIPT_ERROR, message "TOO_MANY_TOOL_CALLS: scripts may make at most 48 tool calls per execution" (was code script_limit from this package). This package keeps only a backstop of 256, to stop a runaway loop if the server misbehaves.
  • Rounds: stay at 8. Only this package counts rounds today; moving that to the server is a separate change.

Why

  • This interpreter runs in the developer's backend and drives each run round by round, so without this change BYO dashboards fail at the 17th call even though the sandbox allows 48.
  • In our benchmark, Sonnet 5.5's only one-call misses at 16 were GitHub dashboards that need more calls; at 48 all 15 generates and edits were correct.

Ship order

Safe on its own: a run over the sandbox's limit fails there, with the sandbox's error. muse main still accepts at most 16 tool results per round, and its prompt still says 16 calls in total, so rounds over 16 only happen once muse#653 (which raises both) is deployed. Ship #653 before telling developers about 48.

Also changes: a round can now ask for up to 48 of the developer's tools (was 16), and one round's outputs can now reach the sandbox's 16 MB per-round cap. A round's batch still runs all at once; capping that (at most 16 tools at a time) is a separate PR.

Changes

  • MAX_TOOL_CALLS 16 → 256 as a backstop, with a comment saying the sandbox owns the real limit. MAX_ROUNDS stays 8.
  • Changeset: @openuidev/server patch.

Testing

@openuidev/server: tsc clean, vitest 11/11, prettier clean.


Child of dashboard-fixes.

🤖 Generated with Claude Code

https://claude.ai/code/session_01DuFZ75cVMd52YVqv9C6XBF

The dashboard interpreter capped a script run at 16 tool calls before the
sandbox's own limit applied. Raise it to 48 to match sandbox-runner#13;
rounds stay at 8. Tests cover 48 calls (in one round and across rounds),
the 49th call, and the 8-round limit.

Claude-Session: https://claude.ai/code/session_01DuFZ75cVMd52YVqv9C6XBF
@vercel

vercel Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
openui-docs Ready Ready Preview Nov 9, 2026 4:42pm UTC

Request Review

abhithesys
abhithesys previously approved these changes Nov 5, 2026
…kstop

OpenUI Cloud's sandbox enforces the tool-call limit per script run (48) and fails the run itself. Hardcoding the same number here meant every limit change needed a release of this package and every app to upgrade. Keep only a high backstop against a misbehaving server. Rounds stay at 8 (only this package counts them).
@Aditya-thesys Aditya-thesys changed the title fix(server): allow 48 tool calls per script run fix(server): leave the tool-call limit to the sandbox, keep a 256 backstop Nov 8, 2026
@Aditya-thesys
Aditya-thesys changed the base branch from main to dashboard-fixes November 8, 2026 10:32
@Aditya-thesys
Aditya-thesys changed the base branch from dashboard-fixes to main November 9, 2026 11:26
A round's whole batch ran at once with Promise.all, so one large batch (48 from an honest sandbox, up to the 256 backstop from a misbehaving server) started that many of the developer's tools simultaneously. A small pool caps it at 16, keeps the result order, and starts no more tools once the run is aborted or times out.
The pool (at most 16 tools at a time per round) goes in a separate PR so this one stays the call-limit change only.
AbhinRustagi
AbhinRustagi previously approved these changes Nov 9, 2026
@Aditya-thesys
Aditya-thesys enabled auto-merge (squash) November 9, 2026 16:40
@Aditya-thesys
Aditya-thesys merged commit 2454f68 into main Nov 9, 2026
4 checks passed
@Aditya-thesys
Aditya-thesys deleted the ap/server-tool-call-cap-48 branch November 9, 2026 16:44

This branch was successfully deployed

1 active deployment
Preview — 809e1698 Deployed Nov 9, 2026 by vercel[bot]
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.

3 participants