Artifact Components
Copy page
Learn how to use artifact components to store and retrieve data from the agent
Artifacts are structured components that capture and store source information when agents interact with tools or other agents. They act as a record-keeping system, automatically documenting where information comes from during tool and agent interactions.
How Artifacts Work
When an agent uses a tool (whether that's another agent or a utility tool), the response is automatically parsed to create artifacts. These artifacts store:
- The source of the information (tool/agent used)
- The relevant content from the response
- Metadata about the interaction
Oversized Artifacts
When tool results exceed 30% of the model's context window, they're marked as oversized to prevent context overflow.
What happens:
- ✅ Full data is persisted to storage
- ❌ Retrieval is blocked to preserve context space
- ⚠️ Visual warnings appear in the UI traces panel
UI Indicators:
- Amber warning badge in timeline:
⚠️ Oversized artifact (~247K tokens) - Detailed warning in expanded view with size and percentage of context
Tracing Attributes:
artifact.is_oversized- Boolean flagartifact.retrieval_blocked- Whether retrieval is blockedartifact.original_token_size- Estimated token countartifact.context_window_size- Model's context limit
Troubleshooting: If seeing many oversized artifacts, consider:
- Filter tool outputs to return only necessary fields
- Paginate large result sets
- Pre-summarize responses in tools
- Use models with larger context windows
Defining Artifact Components
Artifact components are defined using the artifactComponent builder function. We recommend using Zod schemas for type safety and better developer experience.
Quick Start: Citation artifacts are automatically included when you create
a new project with npx @inkeep/create-agents, providing a ready-to-use
example.
JSON Schema is also supported. Set inPreview: true on properties instead of
using preview().
Schema Requirements
Critical: Artifact schemas must match your tool's output structure. The system uses JMESPath selectors on JSON - it cannot extract from free text.
Use OpenTelemetry traces to debug schema validation issues.
Preview Fields
Use preview() to mark fields for immediate availability. The preview() helper automatically sets inPreview: true in the generated schema.
Preview fields are:
- Included in the agent's context when an artifact is referenced, so the agent can reason about them directly
- Shown to other agents in the project for cross-agent reasoning
- Streamed in real-time to clients (Vercel AI SDK)
- Auto-rendered by Inkeep's widget (citations as interactive cards)
- Available immediately in UI (full artifact loads on-demand)
Non-preview fields are persisted in storage but kept out of the agent's working context by default, keeping the context window lean. Agents can retrieve the complete artifact — including all non-preview fields — on demand when they need it.
No schema? Omit props to save the entire tool result without filtering.
Accessing Artifact Data
Agents can access artifact data in a few ways:
- In context — after creating or referencing an artifact, the agent can see its preview fields directly in its working context
- Passing to a tool — the agent can supply an artifact as an argument to a tool; the tool receives the complete artifact data, including all non-preview fields
- On-demand retrieval — the agent can explicitly fetch the full artifact when it needs to read non-preview fields itself
Passing Artifacts to Tools
When an agent passes an artifact to a tool as an argument, the tool receives the complete artifact data — all fields, including those not marked inPreview. This means you can design tools that work with rich artifact content without needing to fetch or reconstruct data manually.
For example, a document processing tool can access the full content array from a citation artifact even though content is a non-preview field:
Artifact Creation
When an agent uses a tool:
- The tool processes the request and returns a response
- The agent decides whether to create an artifact from the tool response
- If created, the artifact is parsed according to the artifact component schema
- The artifact can be associated with any data components that reference this information
Artifacts vs Data Components
Artifacts and Data Components are different:
- Artifacts: Citations/sources from tool results stored in the database
- Data Components: UI elements agents output in responses (Text, Fact, etc.)
Artifacts provide the source citations that back up information in data components.
Using in Agents
After defining your artifact component, use it in an agent:
Citation Artifacts
Citation artifacts that are named citation and have title and url preview fields are automatically rendered as interactive cards by Inkeep's widget library. This provides source attribution and allows users to verify information at the source.

Example Flow
Here's a complete example with inline artifact component definition:
No Schema Example
Example flow:
- Agent uses search tool and gets results
- Agent decides to create an artifact citing the source document
- Artifact is stored with preview fields (title, url) shown to other agents
- Other agents can reference this artifact or get full content when needed