Pattern
INT·Jun 26
Agent DOCX Artifact
Download-first Word artifact pattern. The agent streams Markdown through a tool call, renders a document preview, and exports a real .docx file.
View Full Pattern on Desktop

Problems Solved
- Generate downloadable Word documents from agent output
- Preview document source before download
- Keep binary export client-side from streamed Markdown
Use Cases
- Proposal and report generation
- Client-ready Word drafts
- Memos, briefs, and lightweight contracts
AI SDK APIs
streamTextcreateUIMessageStreamgatewaytooluseChat
Tags
aiworddocxdocumentsoffice-docsstreamingai-sdkartifacts
Requirements
- Node.js
- 24+
- Memory
- 256MB
- Other
- Vercel AI Gateway API key
Environment Variables
AI_GATEWAY_API_KEYGet key →
External Services
openaiupstash
Ready to use?
View the full interactive pattern with live preview and copy the source code.
View Pattern on DesktopRelated Patterns


Agent PDF Artifact
Download-first PDF artifact pattern. The agent streams Markdown through a tool call, renders a live PDF preview, and exports a real .pdf file.
aipdf+5
View →


Agent XLSX Artifact
Download-first Excel artifact pattern. The agent streams CSV through a tool call, renders a spreadsheet preview, and exports a real .xlsx file with SheetJS.
aiexcel+6
View →
End of Pattern



