For the complete documentation index, see llms.txt. This page is also available as Markdown.

Ground an agent using a knowledge base

Connect a knowledge base when an agent needs to answer questions from your documents. The agent searches those documents for relevant passages. Citations let readers open the source behind an answer.

Before you start

If you do not have a knowledge base yet, follow Create a knowledge base to create one and upload your documents, then return here. You also need an agent; start with Build your first AI agent if necessary.

Open the knowledge base and look for Indexed in the document status list. Indexing prepares the document for search; an uploaded file is not necessarily ready. Open a document’s Parsed view to inspect extracted text and Chunks to inspect the passages used for search. If a document shows an error or remains unavailable, use Sync and ingestion lifecycle.

Knowledge base parsed content before attachment

Connect the knowledge base

In Agent Builder, select Add Knowledge Sources → Add Knowledge Base → Select existing Knowledge Base. Choose the knowledge base. Enable Use citations if readers need source references.

Attached knowledge base and citation option

In Instructions, state which questions require a knowledge search. Explain what the agent should do when the documents do not contain an answer. Adapt this pattern:

Agent instructions for knowledge searches

Review an answer and its source

Ask a question covered by the documents.

Answer based on knowledge base documents

Open the source indicator beneath the response. Compare the cited passage with the answer.

Cited source passage for an answer

For a question outside the available information, the response should explain what is missing.

Response when the documents lack an answer

Disconnect a knowledge base

Remove the knowledge source from the agent when it is no longer needed.

Agent after knowledge source removal

Important behavior

Removing the source from an agent does not delete the shared knowledge base.

A citation provides a way to inspect supporting information. Read the cited passage to check whether it supports the answer.

Last updated

Was this helpful?