Skip to content

fix: stop sending strict tools to Anthropic by default - #49

Merged
paperclover merged 1 commit into
mainfrom
push-urutosromrwt
Aug 4, 2026
Merged

fix: stop sending strict tools to Anthropic by default#49
paperclover merged 1 commit into
mainfrom
push-urutosromrwt

Conversation

@paperclover

Copy link
Copy Markdown
Contributor

Anthropic compiles every strict tool schema on a request into one decoding grammar and rejects the whole request with "The compiled grammar is too large" past an undocumented ceiling. alphaXiv's 13-tool assistant clears it, so every turn 400d on claude-sonnet-4-6 while the same payload compiled fine on claude-sonnet-5. Trimming enums, descriptions or whole schema keywords never got under it; only deleting tools did.

Strict is now off unless a model opts in with strictTools, which is only realistic for a small fixed toolset. Losing it costs little in practice: it only shapes arguments once the model has already decided to call a tool, and a 39-query researcher corpus on claude-sonnet-4-6 with strict off produced 151 tool calls with zero rejected arguments and zero invented researcher links, matching the recorded gpt-5.6 baseline.

String formats and their regex patterns also move into the prompt instructions for Anthropic, next to the length and numeric bounds already handled that way. Zod pairs z.iso.date() with a leap-year-aware regex that a grammar has to compile literally, and "must be a valid date" says the same thing. OpenAI keeps them native.

Assisted-by: claude-opus-5

Anthropic compiles every strict tool schema on a request into one decoding
grammar and rejects the whole request with "The compiled grammar is too large"
past an undocumented ceiling. alphaXiv's 13-tool assistant clears it, so every
turn 400d on claude-sonnet-4-6 while the same payload compiled fine on
claude-sonnet-5. Trimming enums, descriptions or whole schema keywords never got
under it; only deleting tools did.

Strict is now off unless a model opts in with `strictTools`, which is only
realistic for a small fixed toolset. Losing it costs little in practice: it only
shapes arguments once the model has already decided to call a tool, and a
39-query researcher corpus on claude-sonnet-4-6 with strict off produced 151 tool
calls with zero rejected arguments and zero invented researcher links, matching
the recorded gpt-5.6 baseline.

String formats and their regex patterns also move into the prompt instructions
for Anthropic, next to the length and numeric bounds already handled that way.
Zod pairs z.iso.date() with a leap-year-aware regex that a grammar has to compile
literally, and "must be a valid date" says the same thing. OpenAI keeps them
native.

Assisted-by: claude-opus-5
@paperclover
paperclover merged commit 7a88269 into main Aug 4, 2026
1 check passed
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