Formats





Pattern
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.
IntermediateJun 2026View the full pattern on desktop


Problems solved
- Stream Markdown as the source for a Word artifact
- Preview document content before download
- Export a real .docx file client-side from streamed Markdown
Use cases
- Proposal and report generation
- Client-ready Word drafts
- Memos, briefs, and lightweight contracts
- Download-first document agents
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 the 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 pattern →


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 pattern →



