Artifacts
Artifacts are structured, interactive outputs that agents produce during conversations. Instead of returning plain text, an agent can produce a rich artifact — an email draft, a meeting invite, a CRM records table, a task, or a calendar view — that the user can review, edit, and act on directly in the chat interface.How artifacts work
When an agent produces an artifact, it creates a typed payload with two components:- Content — the structured data the UI renders (e.g., email fields, meeting details, table rows)
- State — lifecycle status driven by user actions (draft, sent, scheduled, confirmed, cancelled)
Artifact types
| Type | Description | Actions |
|---|---|---|
| Email draft | Structured email with to/cc/bcc, subject, body | Send, edit, discard |
| Meeting invite | Calendar event with attendees, time, agenda | Schedule via Google Calendar |
| Task | Action item with assignee, due date, priority | Create in task system |
| Scheduled task | Recurring or time-triggered agent task | Activate, pause, delete |
| Slack message | Formatted Slack message draft | Send to channel |
| Records table | CRM data table (accounts, contacts, opportunities) | Sort, filter, drill-in |
| Calendar | Inline calendar view | Navigate, click events |
| Plan | Multi-step execution plan | Review, modify steps |
API
List registered artifact types
panel or inline), and streaming support.
Get an artifact
List artifacts in a conversation
Update artifact state
When a user takes action on an artifact (sends an email, schedules a meeting):Edit artifact content
For inline editing (e.g., changing email subject before sending):Execute artifact actions
Summarizers and the caching layer
Every artifact type has a summarizer — a function that takes the full artifact content and produces a compact summary dict. This powers two critical features:LLM context efficiency
When tool results are large (CRM record sets, email threads, meeting lists), the full data would consume the entire context window. Instead, AgentFlow:- Caches the full result in a TTL-scoped result cache
- Summarizes it into a compact dict (total count, field names, 3-row preview)
- Returns the summary to the LLM conversation, with a
cache_idreference - The agent can retrieve the full data later via
get_cached_result(cache_id=...)if needed
Cache-ref artifact auto-registration
Tools that produce cacheable structured output use the@tool(cache_ref=True, summarizer=...) decorator pattern. This automatically:
- Registers a cache configuration (summarizer function, TTL, cache threshold)
- Registers a matching artifact type (so the UI can render the data as a panel)
- Links the tool result to both the cache and the artifact system
(dict, str) -> dict interface — it takes the full result and returns the compact summary:
Built-in summarizers
| Tool category | What’s summarized | TTL |
|---|---|---|
| CRM records | Total count, field names, 3-row preview | 30 min |
| Emails | Total count, field names, 3-row preview | 1 hour |
| Meetings | Total count, field names, 3-row preview | 1 hour |
| Tasks | Total count, field names, 3-row preview | 30 min |
| Slack messages | Total count, has_more flag, 3-message preview | 10 min |
| Record fields/views | Field names, object type, counts | 24 hours |
Agent context injection
Agents automatically receive compact summaries of existing artifacts in the conversation as<system_context> parts. This means the agent knows what drafts are pending, what’s been sent, and what actions the user has taken — enabling natural follow-up interactions like “actually, change the meeting to 3pm” or “add the quarterly numbers to that email”.
When a user takes an action (sends an email, schedules a meeting), an <artifact_action> context part is persisted so subsequent agent turns are aware of what changed.
