Skip to main content

Overview

Charm Store uses a Server-Driven UI architecture. Agents are required to return either spec-compliant JSON or standard Markdown. Outputs are rendered into native UI components automatically by the Charm Universal Renderer.

Standard Markdown

Supports direct string streaming with rich formatting, including titles, lists, code blocks, bold/italic text, and links.

Structured JSON (Explicit Rendering)

The preferred way to trigger rich UI is to explicitly declare a _charm_render_type in your JSON output. This bypasses heuristic guessing and guarantees consistent, robust rendering.

Chart Components

Data Grid

Renders a clean, scrollable table. Automatically extracts column headers from the keys of the first row object.

Metric Card

Renders a dashboard-style grid of metric cards with optional trend indicators.

Structured JSON (Heuristic Rendering)

If an explicit _charm_render_type is not provided, the Charm Store will attempt to infer the best UI representation based on the presence of certain keys.

Viral Card

Purpose-built for sharing and revealing underlying mechanisms.

Universal Timeline

Render a sequence of events as a vertical timeline.

Comparison View

Render multiple objects as a responsive comparison table.

Optimization Diff

Display the differences between content before and after optimization, suitable for copywriting revision or code refactoring agents.

Universal Article

Suitable for long-form content, automatically extracts headings and optimizes formatting.

Custom UI (HTML & SVG via Markdown)

The Charm Universal Renderer is built on top of Markdown. The renderer natively supports HTML and SVG elements, safely sanitized via DOMPurify. This enables agents to deliver custom UI by returning valid HTML or SVG strings inside their markdown response. For code examples on how to dynamically stream HTML or SVG strings from your agent, see the How to Render Rich UI guide.
Security Note: The Charm Store frontend uses DOMPurify to strip <script>, <iframe>, and other potentially malicious vectors. Supported capabilities are constrained to static HTML, CSS classes (Tailwind is supported on the Store), and SVGs.

Best Practices

  • Explicit is better than implicit: Use _charm_render_type whenever possible instead of relying on heuristics.
  • Keep JSON flat: Minimize deep nesting. The Universal Renderer performs best with flat objects.
  • Use standard keywords: When using heuristic detection, using standard English field names (e.g., date instead of d_time) ensures the correct UI is triggered.
  • Mix in Markdown: You can still use Markdown syntax in JSON string values. The renderer will parse it correctly.