Formats

Pattern
Agent Code Artifact
Template-style code artifact with data-codeDelta streaming, CodeMirror Python editor, Pyodide run, in-memory versions, and quick prompts. No database persistence.
IntermediateApr 2026View the full pattern on desktop


Problems solved
- Stream Python code updates with data-codeDelta UI parts
- Edit code in a CodeMirror editor with Pyodide run support
- Keep code versions in memory without database persistence
- Update the artifact from agent tools and quick prompts
Use cases
- Python coding copilots in chat
- Runnable notebook-style demos
- Teaching code artifacts with Pyodide
- In-browser code editors for agents
AI SDK APIs
streamTextcreateUIMessageStreamgatewaytoolconvertToModelMessagescreateUIMessageStreamResponse
Tags
aipythoncodemirrorstreamingai-sdkartifactspyodide
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 desktop






