Skip to main content

Artifact

The Artifact class provides access to typed agent outputs — reports, emails, tasks, and other structured content produced during conversations.

Retrieving artifacts

import agentflow as af

# Get a specific artifact by ID
artifact = await af.Artifact.get("art_abc123")

print(artifact.artifact_type)  # "email_draft"
print(artifact.state)          # {"status": "pending_review"}
print(artifact.content)        # {"subject": "Q3 Update", "body": "..."}

Listing artifacts

# All artifacts in a conversation
artifacts = await af.Artifact.list_for_conversation("conv_abc123")

for artifact in artifacts:
    print(f"{artifact.artifact_type}: {artifact.id}")

# List all registered artifact types
types = await af.Artifact.list_types()
for t in types:
    print(t)

Updating artifacts

# Update artifact state
await artifact.update_state({"status": "approved", "approved_by": "user_123"})

# Update artifact content
await artifact.update_content({
    "subject": "Q3 Update — Revised",
    "body": "Updated projections based on latest data...",
})

Downloading artifacts

# Download the artifact as a file
file_path = await artifact.download()
print(f"Saved to: {file_path}")

Recording interactions

# Track user interactions with the artifact
await artifact.record_interaction("viewed")
await artifact.record_interaction("edited")
await artifact.record_interaction("shared")

Properties

PropertyTypeDescription
idstrArtifact UUID
conversation_idstrConversation that produced this artifact
artifact_typestrRegistered type (e.g., "email_draft", "report")
contentdictArtifact content payload
statedictCurrent state metadata
created_atdatetimeWhen the artifact was created
updated_atdatetimeWhen the artifact was last modified