---
title: Knowledge bases
description: "Create a knowledge base from files, URLs, a crawled website or text, test what it answers, measure it with question sets, and keep it current."
---

A knowledge base is the material an agent can search during a conversation: your
policies, product pages, price lists, help articles. You build and test it under
**Knowledge Bases**, then give it to an agent with the
[Knowledge Base tool](/build/tools/knowledge-base).

Keep the two jobs apart. Facts about your company belong here. What the agent learns
about one person belongs in [Memory](/build/memory).

## What goes into one

A knowledge base is made of sources: files, URLs, or text.

- **Files.** Documents, JSON, and spreadsheets in Excel or CSV.
- **URLs.** Add pages one by one, or switch on **Crawl website**, give a
  **Website URL**, and choose which of the discovered pages to ingest. A Google Doc
  can be added by its **Google Doc URL**. A page has to be publicly reachable to be
  fetched.
- **Text.** Paste content directly. Markdown is supported.

**Sources** lists what the knowledge base is currently made of.

## Creating one

1. Under **Knowledge Bases**, choose **Add Resource**.
2. **Choose your source**: **Text**, **URL**, **File** or **Google Doc**. Clicking a
   card moves straight on to the next step.
3. Give the knowledge base a **Name** and configure the source. For **URL**, pick a
   **Mode**: **URLs** takes pages one by one (**Add URL** queues another), with an
   optional **Auto-update** that refreshes them every 6, 12 or 24 hours;
   **Crawler** takes a **Website URL** and discovers the pages reachable from it.
   A Google Doc must be shared so that anyone with the link can view it.
4. Choose **Create**. With **Crawler**, choose **Discover** instead, pick the pages
   to include, then **Crawl** them.
5. The wizard shows the content being processed, then opens **Test your knowledge
   base** so you can ask a first question.

## Adding more data

**Add data** extends a knowledge base that already exists. Each addition either
appends or replaces:

- **Add to existing data** keeps what is stored and adds the new content on top.
- **Replace** removes all existing content and its search index, then stores the new
  content in its place. The app asks for confirmation, because it cannot be undone.

URL sources can also re-fetch their content on a schedule, so a knowledge base built
from your website follows it as it changes.

## Checking that ingestion worked

Adding a source starts an ingestion job. **Live ingestion** shows the jobs in
progress, and **Ingestion history** keeps every one, including crawled pages that
failed, counted as pages ok and pages failed. When a job fails, an **Ingestion
failed** banner says so and **Retry ingestion** runs it again.

## Testing what it answers

**Test** has two ways in.

- **Test via chat.** Ask questions as a caller would. Answers stream in with the
  sources they came from, so you can see where each claim was found, and suggested
  questions show what the knowledge base can answer.
- **Semantic search.** Search for passages directly. Under **Retrieval options**,
  **Fast search** skips the answer model and returns the matching text only, with no
  generated answer and no sources: the quickest way to check that a passage is in
  there at all.

Test here before connecting the knowledge base to an agent. An agent can only answer
as well as its knowledge base can.

## Measuring it

For more than spot checks, **Evaluation** runs a fixed set of questions against the
knowledge base and keeps each run.

1. Create a dataset of questions. Add them one at a time, import a CSV with
   `question` and `expected_answer` columns (5 MB at most), or generate them from the
   knowledge base.
2. Create an evaluation and start a run.
3. Check **Run history** after you change the sources.

Rerun the same set after every significant change: a run that gets worse tells you
which change to undo.

## Clearing and deleting

**Clear** empties a knowledge base of its content and keeps the knowledge base
itself, ready for new data. **Delete** removes it entirely. Knowledge bases can also
be deleted in bulk from the list.

## Related

- [Knowledge Base tool](/build/tools/knowledge-base)
- [Memory](/build/memory)
- [Evaluations](/test-and-improve/evaluations)
