clawd

Artifact Protocol

Agents can output structured content using <artifact> tags. The chat UI detects these markers and renders them as interactive visual cards with copy, download, and fullscreen controls.

Syntax

<artifact type="TYPE" title="TITLE">
CONTENT
</artifact>

Supported Types

Type Content Rendering
html HTML markup Sandboxed iframe, DOMPurify-sanitized
react JSX component (function App) Babel + Tailwind in sandboxed iframe
svg SVG markup Inline, DOMPurify-sanitized
chart JSON spec Interactive Recharts component
csv CSV with header row Sortable data table
markdown Markdown text Full markdown pipeline
code Source code Prism syntax highlighting
interactive JSON component spec Rendered inline as interactive UI widgets

Chart JSON Format

{
  "type": "line",
  "data": [{"month": "Jan", "sales": 100}, {"month": "Feb", "sales": 150}],
  "xKey": "month",
  "series": [{"key": "sales", "color": "#8884d8", "name": "Sales"}],
  "title": "Monthly Sales"
}

Chart types: line, bar, pie, area, scatter, composed. Max 1000 data points, 10 series.

Pie chart uses different fields: {"type":"pie","data":[{"name":"A","value":100}],"dataKey":"value","nameKey":"name"}

Composed chart mixes types: series items can have "type":"line"|"bar"|"area" to overlay different chart types on the same axes.

When to Use Artifacts

Use artifacts for:

Do NOT use artifacts for:

Code Artifact Extras

The code type accepts an optional language attribute:

<artifact type="code" language="python" title="Data Processor">
def process(items):
    return [transform(i) for i in items]
</artifact>

React Artifact Environment

React artifacts run in a sandboxed iframe with:

No imports needed — React and ReactDOM are pre-loaded.

Escaping

Content must NOT contain literal </artifact>. Use &lt;/artifact&gt; if documenting the protocol itself.

Rendering Locations

Type Renders On Click
chart Inline in message (interactive Recharts)
svg Inline in message (DOMPurify sanitized)
code Inline in message (Prism highlighting)
html, react, markdown Preview card in message Opens sidebar panel
csv Preview card in message Sortable data table in sidebar
interactive Rendered inline in message No modal — widgets render directly in chat

When series is omitted from chart specs, series are auto-inferred from numeric data keys.

React Artifacts

Limitations

Security