Skip to content

Conversation

@tsuzaki430
Copy link
Collaborator

@tsuzaki430 tsuzaki430 commented Oct 20, 2025

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

  • add response property file_id in code-execution-20250825
  • add example downloading file.

Example

Use code execution to have the AI ​​create an Excel file. Get the executed python code.
anthropic_code_execution_file_download

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

  • packages/anthropic/src/anthropic-messages-language-model.test.ts
    • add fixtures anthropic-code-execution-20250825.2 for file_id return pattern.
    • check the snapshot and file_id was included in the result.

examples/ai-core

  • add the examples, src/stream-text/anthropic-code-execution-20250825-downloads.ts
  • add the examples, src/generate-text/anthropic-code-execution-20250825-downloads.ts

examples/next-openai

  • fix /components/tool/anthropic-code-execution-view.tsx (add a download button)
  • add route for submit native download api and provide files. /app/api/code-execution-files/anthropic/[file]/route.ts

Checklist

  • Tests have been added / updated (for bug fixes / features)
  • Documentation has been added / updated (for bug fixes / features)
  • A patch changeset for relevant packages has been added (for bug fixes / features - run pnpm changeset in the project root)
  • Formatting issues have been fixed (run pnpm prettier-fix in the project root)
  • I have reviewed this pull request (self-review)

Related Issues

Fixes gap from #9435

@tsuzaki430 tsuzaki430 marked this pull request as ready for review October 20, 2025 16:20
@tsuzaki430
Copy link
Collaborator Author

Hello ,
I finished self-review.
Thank you for every day's update!

@tsuzaki430 tsuzaki430 requested a review from lgrammel October 20, 2025 16:21
@lgrammel lgrammel changed the title feat(anthropic) add return file_id property for anthropic code-execution-20250825 to download output files. feat(provider/anthropic): add return file_id property for anthropic code-execution-20250825 to download output files Oct 23, 2025
@lgrammel
Copy link
Collaborator

This is great! I'll update the changeset and merge.

@tsuzaki430
Copy link
Collaborator Author

@lgrammel

Hello , thank you for the review😊
I just remove examples from changeset!

@lgrammel lgrammel self-assigned this Oct 23, 2025
@lgrammel lgrammel merged commit 80894b3 into vercel:main Oct 23, 2025
17 of 18 checks passed
vercel-ai-sdk bot pushed a commit that referenced this pull request Oct 23, 2025
@vercel-ai-sdk
Copy link
Contributor

vercel-ai-sdk bot commented Oct 23, 2025

⚠️ Backport to release-v5.0 created but has conflicts: #9737

lgrammel added a commit that referenced this pull request Oct 23, 2025
… anthropic code-execution-20250825 to download output files (#9737)

This is an automated backport of #9669 to the release-v5.0 branch.

---------

Co-authored-by: tsuzaki430 <58161200+tsuzaki430@users.noreply.github.com>
Co-authored-by: Lars Grammel <lars.grammel@gmail.com>
@tsuzaki430 tsuzaki430 deleted the tsuz/anthropic-code-execute-file-id branch October 23, 2025 11:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants