Grounding¶
The Grounding module provides components for visualizing the knowledge retrieval and grounding context of an agent's response. These components show what information the agent used to generate its answer, including RAG chunks, canonical documents, grounding policy, and web research references.
Components¶
| Component | Description |
|---|---|
| AgentRetrievedSources | RAG retrieval chunks with document titles, text excerpts, and relevance scores |
| AgentAttachedDocuments | Canonical documents with MIME type icons, file sizes, and source badges |
| AgentGroundingPolicy | Color-coded badge showing the active grounding mode |
| AgentGroundingPreparation | Consolidated view combining RAG chunks, canonical documents, and grounding decision |
| AgentResearchDetails | Web research references and grounding metadata |
Grounding Context¶
All grounding components read from the groundingContext object returned in the agent response. This object is populated by the backend framework's grounding pipeline:
interface GroundingContext {
/** RAG retrieval chunks */
ragChunks?: GroundingContextRagChunks;
/** Canonical documents attached for grounding */
canonicalDocuments?: GroundingContextCanonicalDocuments;
/** Document composition bundles */
composition?: GroundingContextComposition;
/** Grounding decision (policy, mode, reasoning) */
decision?: GroundingContextDecision;
}
Grounding Modes
The grounding policy controls what information reaches the LLM. In attachments_only mode, RAG chunks are excluded from the prompt and only canonical documents are used. The AgentGroundingPolicy component displays the active mode as a color-coded badge.
Quick Example¶
import {
AgentRetrievedSources,
AgentAttachedDocuments,
AgentGroundingPolicy,
} from "@modernpath/agent-ui-react";
function GroundingView({ data }: { data: any }) {
return (
<div>
<AgentGroundingPolicy data={data} />
<AgentRetrievedSources data={data} />
<AgentAttachedDocuments data={data} />
</div>
);
}
Related Pages¶
- AgentChat -- renders grounding components automatically
- Knowledge Base (Backend) -- backend RAG retrieval and grounding pipeline
- Grounding Policy (Backend) -- backend grounding policy configuration