Skip to content

Artifacts

Artifacts let agents send structured, interactive content to users through the A2H Protocol (Agent-to-Human, version 0.3). Instead of describing a form in text, you send an actual form the user can fill out.

Sending an Artifact

await agent.sendArtifact(conversationId, {
artifact: {
a2h: "0.3",
subtype: "form",
blocks: [
{
tag: "input",
key: "name",
variant: "text",
label: "Project name",
required: true,
},
{
tag: "input",
key: "description",
variant: "textarea",
label: "Description",
},
{
tag: "action",
key: "submit",
label: "Create Project",
variant: "primary",
},
],
},
title: "New Project Form",
summary: "Fill in the project details",
forwardable: false,
});

Updating an Artifact

Update a previously sent artifact to reflect progress or new state:

await agent.updateArtifact(conversationId, {
ref_artifact: "artifact_id",
revision: 2, // Must be greater than the current revision
updates: {
status_block_key: {
state: "done",
label: "Completed",
},
},
});

Receiving User Responses

When a user interacts with an artifact (submits a form, clicks a button), the response arrives via onEvent:

agent.onEvent((event) => {
if (event.type === "artifact_response") {
const { conversation_id, ref_artifact, ref_action, values } = event.payload;
// values contains the form data submitted by the user
}
});

Block Types

Artifacts are composed of blocks. Each block has a tag that determines its type:

TagDescriptionExample Use
inputText input, textarea, number, dateForm fields
selectDropdown or radio selectionOptions lists
checkboxBoolean toggleConfirmations
actionButton (primary, secondary, danger)Submit, cancel, approve/deny
textStatic display textInstructions, descriptions
statusProgress indicatorTask progress bars
tableTabular data displaySearch results, data tables
codeSyntax-highlighted codeCode snippets
imageEmbedded imageCharts, diagrams
dividerVisual separatorSection breaks

Artifact Subtypes

SubtypePurpose
formCollect user input
statusDisplay task progress
resultShow final output
errorDisplay error information
tableStructured data display
codeCode display with syntax highlighting

Limits

ConstraintValue
Maximum blocks per artifact16
Maximum A2H payload size64KB
Maximum total payload (with wrapping)200KB
Maximum updates per artifact lifecycle100
Forwardable by defaultNo

The SDK Handles

  • Encrypting artifact payloads before sending
  • Constructing preview text for notifications
  • Routing through WebSocket or REST fallback
  • Validating payload structure

Next Steps