Skip to content

fix(provider): preserve anthropic provider-executed tool pairs#25861

Open
nexxeln wants to merge 1 commit intodevfrom
nxl/fix-anthropic-provider-tools
Open

fix(provider): preserve anthropic provider-executed tool pairs#25861
nexxeln wants to merge 1 commit intodevfrom
nxl/fix-anthropic-provider-tools

Conversation

@nexxeln
Copy link
Copy Markdown
Member

@nexxeln nexxeln commented May 5, 2026

summary

  • Keep Anthropic's client tool-call normalization, but classify only non-provider-executed tool calls/results as movable client tool parts.
  • Preserve provider-executed tool-call/tool-result pairs in assistant content because the AI SDK intentionally represents server-side tools that way.
  • Add regressions for client co-located results, provider-executed trailing text, and mixed client/provider-executed tool content.

why this over #25775

testing

  • bun test test/provider/transform.test.ts
  • bun typecheck
  • push hook: bun turbo typecheck

Closes #25774

@bbartels
Copy link
Copy Markdown
Contributor

bbartels commented May 5, 2026

While you are looking into anthropic issues, would highly appreciate looking into: #14332 as well.

Have a pr out here: #23755, (happy to fix the merge conflicts, but also happy for you to just use this as inspiration)

Your PR, plus a fix for: #14332 would solve all the anthropic related errors we have been running into :)

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.

fix(provider): Anthropic normalize splits tool-call from tool-result causing dangling tool_use error

2 participants