Problem
@ai-sdk-tools/agents currently strips type: "file" parts from user messages before saving chat history. This breaks workflows where attachments are already-uploaded URLs (e.g. Vercel Blob) and need to remain available on later turns for tool calls (“use the attached image”).
Where
packages/agents/src/agent.ts filters user message parts with:
part.type !== "file" (file parts excluded from storage)
Why this matters
Many apps send “attachments” as { type: "file", url: "https://..." } (not raw bytes). Dropping these means the agent can’t reference the attachment in follow-up turns, so tools expecting fileUrl can’t reliably work.
Request
Add a config option to control file-part persistence in history, defaulting to current safe behavior:
history.fileParts: "drop" | "keep-urls" | "keep-all" (default "drop")
Suggested behavior:
- keep-urls: store only URL-based file parts (and optionally allowlist hosts), drop binary/base64.
Example
{
"role": "user",
"content": [
{ "type": "file", "mediaType": "image/png", "filename": "x.png", "url": "https://public-blob-url" },
{ "type": "text", "text": "Upload this image to Strapi" }
]
}