Repository navigation
fix(vercel-ai-sdk): download prompt image and file URLs in the model Activity - #468
Merged
Merged
Conversation
brianstrauch
left a comment
Member
There was a problem hiding this comment.
Three findings covering replay compatibility, downloaded content in Activity result metadata, and image MIME normalization.
moetemp
force-pushed
the
fix/vercel-ai-sdk-prompt-file-urls
branch
from
November 13, 2026 07:48
cfc3706 to
6a47a28
Compare
brianstrauch
approved these changes
Nov 13, 2026
The AI SDK downloaded them in Workflow code, where there is no network, and the Workflow task failed.
…s, detect image types A history where experimental_download ran an Activity did not replay. The model Activity also returned the downloaded bytes in request.body, and kept a wrong media type for an image.
moetemp
force-pushed
the
fix/vercel-ai-sdk-prompt-file-urls
branch
from
November 13, 2026 17:04
6a47a28 to
8546d0d
Compare
campoy
added a commit
that referenced
this pull request
Nov 16, 2026
Replay is promised only within a major, and the next Vercel AI SDK release is 2.0.0. Two patches only kept 1.x runs on their old paths, so they go: - vercel-ai-sdk-download-urls-in-model-activity (#468): the model always reports that it supports every URL, so the model Activity downloads them. - vercel-ai-sdk-abort-signal-cancels-model-activity (#470): a caller's abortSignal always cancels the model Activity. The README says which 1.x runs don't replay.
campoy
added a commit
that referenced
this pull request
Nov 16, 2026
…586) ## What was changed The next Vercel AI SDK release is 2.0.0, so its current major is 2, and replay is promised only within a major. Two patches only keep 1.x runs on their old paths, so let's remove them before 2.0: - `vercel-ai-sdk-download-urls-in-model-activity` (#468): the model always reports that it supports every URL, so URL parts always go to the model Activity, which downloads them. - `vercel-ai-sdk-abort-signal-cancels-model-activity` (#470): a caller's `abortSignal` always cancels the model Activity. The README drops both patch notes and says which 1.x runs don't replay. ## What will you notice? (Breaking) Two kinds of 1.x run don't replay on 2.0. Let them finish on 1.x Workers before you upgrade, or keep them there with Worker Versioning: - A run in which an `experimental_download` function scheduled an Activity for a URL. On 2.0 the model call comes first: `[TMPRL1100] Activity type of scheduled event 'downloadNotes' does not match activity type of activity command 'invokeModel'`. - A run in which a signal aborted while a model or embedding call ran. On 1.x the abort sent no command, and on 2.0 it cancels the Activity, so sdk-core fails the replay with `Fatal error in workflow machines: ActivityMachine in state ScheduledActivityCancelCommandCreated says the transition is invalid`. A run on a `main` build since #468 or #470 that took the new path recorded the marker, so it doesn't replay either. No release wrote those markers. ## Why? We decided that replay is promised only within a major, and that a gate that only protects an older major's runs is removed before the next major ships. The Vercel AI SDK plugin's next release is 2.0.0, so these gates go before it. ## Checklist 1. No issue. 2. How was this tested: - `make sync`, `make lint` and `make test` for `typescript/vercel-ai-sdk`, in Docker with Node 24: 133 tests passed. - Replay: the three 1.x histories that #565 stops replaying, run through the replay tests #565 removes, on #565 and on this PR. On #565 all three replay. On this PR, the `experimental_download` and abort histories fail as above, and the one with a model call next to a plain Activity still replays. 3. Any docs updates needed? The README changes are here.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed?
This PR makes image and file URLs in a prompt work.
TemporalLanguageModel.supportedUrlsaccepts every URL, sogenerateTextdoesn't download in the Workflow.supportedUrls. A URL the model supports goes to the model. The others are downloaded withcreateDownload()and sent as bytes.generateText.request.body, so the bytes stay out of Event History.downloadonAiSdkPluginandcreateActivities, to replace the download function.@ai-sdk/provider-utilsis now a direct dependency, at the versionaialready pins.Fixes #AI-950
Why?
supportedUrlsreturned{}, so the AI SDK downloaded each URL in Workflow code. The sandbox has no network, and the Workflow task failed on every attempt.createDownload()refuses local and private addresses. Thedownloadoption is for users with an internal file server. I'm OK with dropping it if we don't want more API in 2.0.0.Event History stores the URL, not the bytes. A retried Activity downloads again.
In-flight runs
The
supportedUrlschange is behind a Workflow patch. A Workflow could givegenerateTextanexperimental_downloadfunction that ran an Activity, and that Activity is in its Event History. Such an execution replays as it ran then. The new behavior starts with its first model call that isn't a replay.How did you test it?
experimental_downloadran an Activity, replays on this branch. It fails to replay without the patch gate.make lintandmake testpass intypescript/vercel-ai-sdk.