Skip to content

Canvas

Canvas is the artifact system that lets the agent produce structured, versioned outputs beyond plain text. When the agent generates code, diagrams, or documents, they appear as interactive artifacts in the web UI.

TypeDescriptionExample use
codeSource code with syntax highlightingGenerated scripts, config files
markdownRendered markdown documentsReports, summaries, documentation
htmlSandboxed HTML previewPrototypes, email templates
mermaidRendered Mermaid diagramsFlowcharts, sequence diagrams, ER diagrams
textPlain textNotes, logs, raw data

The agent uses the create_artifact tool:

{
"conversationId": "conv_abc123",
"type": "code",
"title": "deploy.sh",
"content": "#!/bin/bash\npnpm build && fly deploy",
"language": "bash"
}

The language field is optional and only relevant for code type artifacts.

When the agent modifies an artifact, it uses update_artifact:

{
"id": "art_xyz789",
"content": "#!/bin/bash\npnpm build && fly deploy --strategy rolling"
}

Each update creates a new version. Previous versions are preserved.

All artifact versions are stored in the artifact_versions table. You can browse and restore any previous version.

MethodPathDescription
GET/api/artifacts/:id/versionsList all versions
GET/api/artifacts/:id/versions/:versionGet a specific version
MethodPathDescription
GET/api/artifactsList artifacts (query: conversationId)
GET/api/artifacts/:idGet artifact with current content
POST/api/artifactsCreate artifact
PATCH/api/artifacts/:idUpdate artifact (creates new version)
DELETE/api/artifacts/:idDelete artifact and all versions
EventFields
artifact:createdartifactId, conversationId, title, artifactType
artifact:updatedartifactId, conversationId, title, version
ToolParametersDescription
create_artifactconversationId, type, title, content, language?Create a new artifact
update_artifactid, content, title?, type?, language?Update existing artifact