Formats

Pattern

Agent Mermaid Artifact

Template-style Mermaid artifact with data-mermaidDelta streaming, diagram preview and source editor, SVG/PNG export, in-memory versions, and quick prompts — no database persistence.

IntermediateApr 2026View the full pattern on desktop
Agent Mermaid Artifact preview

Problems solved

  • Stream Mermaid diagram JSON with custom UI data parts
  • Template-style Artifact class without a full chat backend

Use cases

  • Onboarding and architecture explanations
  • Demos without database wiring

AI SDK APIs

streamTextcreateUIMessageStreamgatewaytool

Tags

aimermaiddiagramarchitecturestreamingai-sdkartifacts

Requirements

Node.js
24+
Memory
256MB
Other
  • Vercel AI Gateway API key

Environment variables

External services

openaiupstash

Ready to use?

View the full interactive pattern with live preview and copy the source code.

View the pattern on desktop

Related patterns

You’ve reached the end of this pattern.