feat(provider/anthropic): add return file_id property for anthropic code-execution-20250825 to download output files#9669
Conversation
|
Hello , |
file_id property for anthropic code-execution-20250825 to download output files.file_id property for anthropic code-execution-20250825 to download output files
|
This is great! I'll update the changeset and merge. |
…com/tsuzaki430/ai into tsuz/anthropic-code-execute-file-id
|
Hello , thank you for the review😊 |
|
|
|
Guys any documentation on how to download the said fileId ? Do we need to get it directly from anthropic ? or is there a way to seamlessly get it from AI SDK, the file ? |
|
Thanks for the question! As far as I know, after you obtain the Here are examples that only use
And here is a Next.js example:
The downloading route is here: I’m not sure there is dedicated documentation for this flow yet, but I’m confident that you can implement file downloads for code execution results in your app using this approach. Does this help answer your question? 🙂 |
Background
The Anthropic code execution bash tool provides a list of the generated files. This feature was missing from #9435 (although present in the zod schemas). It enables downloading generated files from the Anthropic API.
Summary
file_idin code-execution-20250825Example
Use code execution to have the AI create an Excel file. Get the executed python code.

prompt:
Write a Python script to calculate fibonacci number and then execute it to find the 10th fibonacci number finally output data to excel file and python code.Manual Verification
package/anthropic
anthropic-code-execution-20250825.2for file_id return pattern.examples/ai-core
examples/next-openai
Checklist
pnpm changesetin the project root)pnpm prettier-fixin the project root)Related Issues
Fixes gap from #9435