Description
Anthropic has released code_execution_20260120, the latest version of their code execution tool, which is now the recommended version for programmatic tool calling.
The AI SDK currently only supports code_execution_20250825 via anthropic.tools.codeExecution_20250825(). The newer version does not require a beta header and is supported on Claude Opus 4.6, Sonnet 4.6, Sonnet 4.5, and Opus 4.5.
What's needed
- A new
anthropic.tools.codeExecution_20260120() factory (can reuse the 20250825 input/output schemas — they're the same)
- A
case "anthropic.code_execution_20260120" in prepareTools (I didn't need a beta header in testing, but it may still be required?? Maybe anthropic is on the verge of GA)
- Tool name mapping entry:
"anthropic.code_execution_20260120": "code_execution"
- Zod response schemas updated to accept
"code_execution_20260120" as a valid caller.type (currently only "code_execution_20250825" | "direct")
- Runtime caller reconstruction in
convertToAnthropicMessagesPrompt to handle the new caller type
- TypeScript type declarations for the new factory
Workaround
We're using patch-package to add all of the above to @ai-sdk/anthropic@3.0.46. Happy to open a PR if helpful.
Related
AI SDK Version
- ai: 6.0.71
- @ai-sdk/anthropic: 3.0.46
Code of Conduct
Description
Anthropic has released
code_execution_20260120, the latest version of their code execution tool, which is now the recommended version for programmatic tool calling.The AI SDK currently only supports
code_execution_20250825viaanthropic.tools.codeExecution_20250825(). The newer version does not require a beta header and is supported on Claude Opus 4.6, Sonnet 4.6, Sonnet 4.5, and Opus 4.5.What's needed
anthropic.tools.codeExecution_20260120()factory (can reuse the20250825input/output schemas — they're the same)case "anthropic.code_execution_20260120"inprepareTools(I didn't need a beta header in testing, but it may still be required?? Maybe anthropic is on the verge of GA)"anthropic.code_execution_20260120": "code_execution""code_execution_20260120"as a validcaller.type(currently only"code_execution_20250825" | "direct")convertToAnthropicMessagesPromptto handle the new caller typeWorkaround
We're using
patch-packageto add all of the above to@ai-sdk/anthropic@3.0.46. Happy to open a PR if helpful.Related
code_execution_20250825supportAI SDK Version
Code of Conduct