# Knowledge base

> Add documents your agent can look things up in, and test what it finds.

Source: https://docs.vlayers.ai/build/knowledge-base

Kind: How-to guide

## What you'll learn

How to add documents to your knowledge base, search them to see what an agent would find, and remove them. A flow reads from the knowledge base with the **Knowledge** step ([Flow builder](https://docs.vlayers.ai/build/flow-builder)).

## Add a document

1. Open **Knowledge base** (under **Build**).
2. Choose **Add document**.
3. Enter a **Title** (such as "Refund policy"). Optionally add a **Source URI**, the page the text came from.
4. Paste the text into **Content**.
5. Optionally add **Metadata (JSON)**, such as `{"category":"faq","language":"en"}`. You can filter searches on it.
6. Save. The document appears in the table.

## Search it

Use the search box on the same page: type a question, optionally add a metadata filter such as `{"category":"faq"}`, and search. You see the matching passages with a similarity score. Use this to check that the answer you expect is found before a caller asks.

## Remove a document

Choose **Delete** on its row and confirm **Delete document**. Agents stop finding it.

## Common problems

| Problem | Fix |
|---|---|
| The right passage does not come back | Split a long document by topic, and put the question's own words in the text. |
| A metadata filter returns nothing | The filter must match the metadata exactly, key and value. |

## Next steps

- [Flow builder](https://docs.vlayers.ai/build/flow-builder): Use the Knowledge step in a flow.
- [Tools](https://docs.vlayers.ai/build/tools): Look things up in your own systems instead.
