Add citations to your customer assistant
Copy page
Auto-render inline source pills and a Sources list on every customer-assistant answer.
Overview
In this guide, you'll add citations to the customer assistant you built in Setup. Once wired up, every fact the assistant references gets saved as a structured citation artifact that the Inkeep widget auto-renders as inline source pills and a Sources list below the answer.
Prerequisites
- You completed the Customer Assistant setup tutorial — a working sub agent connected to Inkeep Unified Search.
Why citations are wired this way
Why an artifact, not a URL in the text
The easy thing for an AI to do is paste [Title](URL) into its response. That breaks down fast:
- The agent can hallucinate URLs that look right but don't exist.
- The widget has no structured handle to render rich source cards from — it would just be a link.
- Other sub agents in your project can't reason about "what sources did the previous agent use" because that information is buried in prose.
An artifact is a structured record the agent saves. It has a fixed schema (title, url, content, etc.), gets persisted in storage, and can be referenced by ID across the conversation. The widget knows how to find these and render them.
Why the artifact must be named citation
The Inkeep widget has a built-in contract: any artifact named exactly citation with url as a preview field gets auto-rendered — no frontend code required. The widget produces inline source pills with the response text and a Sources list beneath the answer.
If you name it something else (source, reference, link), the artifact still saves correctly, but the widget won't auto-render it. You'd need to write a custom React component to display it. For a customer assistant, you want the auto-render — name it citation.
Create the citation artifact
In the Visual Builder, click Artifact Components in the left sidebar, then New Artifact Component.
Fill in:
- ID:
citation - Name:
citation(must match exactly — this is what the widget auto-renders) - Description:
Structured factual information extracted from search results
Paste the JSON schema below into the Props schema field, then click Save.
Props schema:
Attach the citation artifact to your sub agent
Go to your agent canvas: Agents → Customer assistant.
Click the sub agent on the canvas to open its config in the right sidebar.
Scroll to the Artifact Components section and add the citation artifact you just created.
Click Save Changes in the top right corner.
Update the prompt to cite consistently
Attaching the artifact tells the agent the artifact exists, but the agent still needs to be told when and how to use it. LLMs won't reliably save artifacts unless the prompt explicitly says so — leave it implicit and you'll get inconsistent or missing citations.
Replace your sub agent's prompt with the version below.
Prompt:
The phrase "BEFORE using it" matters. Without it, the agent will often write the answer first and skip saving the citation. The widget can only render what was saved as an artifact — so the order matters.
Click Save Changes in the top right corner.
Test your agent
Click Try it in the top right corner to open the chat interface.
Ask a product question your docs should be able to answer — for example, "How do I get started?" or "What are the main features?"
Next steps
- Add human escalation — when the agent can't help, hand off to a human via a support ticket with full conversation context.
Setup
Step-by-step tutorial to build an AI assistant that answers your customers' questions, grounded in your knowledge base via Inkeep Unified Search.
Escalation
Teach your assistant when to hand off to a human — and wire it up to your ticketing system so the support team gets the question with full conversation context already attached.