The flagship AgentHTML example. An AI agent produced this entire
.html file from a short prompt. It's not a report you read — it's
a tool you use.
open artifact.html # macOS
xdg-open artifact.html # Linux
start artifact.html # WindowsThe page runs in mock mode — agent calls return baked-in responses so the demo works offline.
- Edit the commit on the left. Bindings sync to state in real time.
- Pick a tone and a length. Try
Terse / ShortvsExplanatory / Long— the rewrites should be qualitatively different. - Hit Rewrite. Right pane fills with the new commit, plus three follow-up buttons: Copy, Regenerate, Push back.
- Click "Push back on this tone." The agent argues for the opposite tone — this is the moment that makes the case for agent-aware artifacts. A static document can't do this.
| Protocol feature | Used here for |
|---|---|
<script id="agenthtml-state"> |
Holds input, tone, length, scope |
data-agent-bind on textarea |
Keeps the input synced to state |
| Custom segmented controls | Update state on click (no data-agent-bind needed for radio-style groups) |
data-agent-action on Rewrite |
Sends the prompt envelope to the agent |
data-agent-context |
Tells the agent which state slots to include |
data-agent-target |
Specifies where to render the response |
| Push-back as a second action | Same protocol, different prompt — argues against the chosen tone |
From the user prompt alone (see prompt.md):
- The artifact's content is dev-facing → pick Editorial Dark preset
- The artifact has tweakable parameters → make it agent-aware
- The user said "mock the agent calls" → swap the live adapter for an inlined mock function with realistic responses across all 12 (tone × length) combos
- The user said "push back" → add a counter-argument button that uses the same protocol with a different prompt
No part of this was hand-coded after the agent produced it.
Replace the mock at the bottom of artifact.html with one of the adapters
from skills/agenthtml/references/agent-protocol.md.
The protocol stays the same; only the adapter swaps.