Artifact Card
Render the final output of an agentic workflow with export and provenance tracing.
Install
npx ax-depute@latest add artifact-cardpnpm dlx ax-depute@latest add artifact-cardyarn dlx ax-depute@latest add artifact-cardbunx ax-depute@latest add artifact-cardOverview
The agent's "receipt" of work completed. It renders the final output alongside crucial provenance data: precisely which plan step and tool calls generated it. It also provides integrated export options.
Analysis Report
markdownBasic usage
<Artifact Card
artifact={myArtifactData}
/>With mock data
Because Artifact Card requires a full artifact object to render, here is an example of what that object looks like:
import { Artifact Card } from '@/components/Artifact Card';
import type { Artifact } from '@/types/ax-common';
const mockArtifact: Artifact = {
id: 'art_123',
type: 'code',
title: 'Database Schema Migration',
createdAt: new Date(),
content: 'CREATE TABLE users (id SERIAL PRIMARY KEY, name VARCHAR(50));',
sourceStepId: 'step_2',
toolCallIds: ['call_456']
};
export function App() {
return (
<Artifact Card
artifact={mockArtifact}
exportFormats={['markdown', 'sql']}
onExport={(format) => console.log(`Exporting as ${format}`)}
showPreview={true}
/>
);
}Streaming state
When content is still arriving from a live backend, pass isStreaming. Adds data-streaming="true" to the root — no built-in animation; the host product styles it:
<ArtifactCard
artifact={partialArtifact}
showPreview
isStreaming={agent.isStreaming}
/>Props
| Prop | Type | Default | Description |
|---|---|---|---|
artifact | Artifact | Required | The artifact object to display (contains title, type, content, etc.). |
exportFormats | ExportFormat[] | undefined | Array of available export formats to show as action buttons (e.g., 'markdown', 'json'). |
onExport | (format: ExportFormat) => void | undefined | Callback fired when an export button is clicked. |
showPreview | boolean | true | Whether to render a preview of the artifact's content inside the card. |
maxPreviewHeight | string | '24rem' | Maximum height of the content preview area before an internal scrollbar appears. |
isStreaming | boolean | false | Signals that content is still arriving. Adds data-streaming="true" to the root element — no built-in animation; style via CSS. |
When to use
- The agent has completed a workflow and produced a discrete, shareable output (document, code, report, data) that the user needs to review, export, or act on
- Provenance matters — the user should be able to trace the output back to the specific plan step and tool calls that produced it
- The output type varies across runs (markdown, JSON, code, SQL) and you need a single component that handles all of them
When not to use
- The agent's output is a direct action that has already been executed (e.g., an email sent, a file deployed) — use
Transaction ReceiptorDecision Recordinstead - The output is a streaming partial — wait for completion or use
isStreamingonly as a transitional state, not a permanent one - You only need to display a success/failure confirmation with no shareable content — a simple status notification is less heavyweight
Accessibility
- The artifact content area is a
<section>witharia-labelderived from the artifact title (e.g., "Artifact: Database Schema Migration") - Export buttons have explicit
aria-labelvalues that include the format (e.g., "Export as Markdown") - Streaming content is announced via
aria-live="polite"so screen readers track new content arriving without interruption - Code content is rendered inside
<pre><code>with appropriaterole="region"andaria-label="Code output"for keyboard traversal - Provenance metadata (step ID, tool calls) is rendered as readable text, not hidden behind hover states
Solution Patterns
Artifact Card is the grand finale of a single-agent execution sequence:
Plan Card → Approval Gate → Run Controls → Tool Trace → [Artifact Card]Once the agent finishes its work, the trace concludes and this component is rendered to display the final, tangible output.
Design rationale
Why the "Receipt" Pattern? In traditional SaaS, the UI is the application. In agentic software, the UI is often just the exhaust of the application. The Artifact Card treats the final output as a primary, shareable asset.
Why verifiable provenance? Trust requires auditability. The sourceStepId and toolCallIds metadata fields visually connect the final artifact back to the exact operations that produced it, preventing "hallucinated outputs" from passing without scrutiny.
Why focus on actionability? Agents excel at generation, but humans excel at distribution. Integrated exportFormats acknowledge that the artifact's lifecycle doesn't end in the chat UI—it needs to be pulled into PRs, Slack messages, or Google Docs.