Add Citations in Agent Responses
To build trust in Agentforce Service Agent responses, include citations to source information. Citations appear in static text messages as a citationContent field in the outbound message event payload. To support this optional feature, parse the citationContent field and render inline markers and a sources list in your UI. For example, include inline markers like [1], [2] and a Sources section at the end of the message. There’s no capability registration required to turn on the feature.
Citations appear in static text messages as an optional citationContent field. This field contains:
- Citation references: Links to source articles with optional display labels and optional Salesforce record IDs
- Inline metadata: Character offset positions indicating where citation markers should appear in the message text
When a message includes citations, the staticContent object contains a citationContent field.
All offsets are zero-indexed character positions in the staticContent.text field.
citedLocationOffsetspecifies where to insert a citation marker (e.g., [1])claimStartOffset/claimEndOffsetdefine which portion of the text the citation supports.
The citation schema uses a discriminator pattern with the following fields.
| Field | Type | Description |
|---|---|---|
CitationContent | Object | Contains an array of citation objects. |
citations | Array | Array of citation objects |
citation | Object | Represents a single citation reference and its metadata. |
citedReference | Object | The source being cited (currently supports Link type). |
citedDetails | Object | Metadata about where the citation applies in the message text. |
LinkCitedReference | Object | Citation reference pointing to a URL. |
citedReferenceType | String | Must be "Link". |
link | Object | Link object containing a url field. |
label | String | Display label for the citation (e.g., "example" for example.com). |
recordId | String | Salesforce record ID if citation links to a Salesforce object. |
InlineMetadataCitedDetails | Object | Specifies where citations should appear in the message text. |
citedDetailsType | String | Must be "InlineMetadata". |
inlineMetadata | Array | Array of metadata objects (minimum 1). |
citedLocationOffset | Integer | Zero-indexed character position where citation marker should be inserted. |
claim | Object | Defines the text span this citation supports with claimStartOffset and claimEndOffset (both integers). |