> ## Documentation Index
> Fetch the complete documentation index at: https://docs.veadk.xyz/llms.txt
> Use this file to discover all available pages before exploring further.

# Knowledge base retrieval

## Overview

Tool identifier `load_knowledgebase`.

System tools are built-in tools that VeADK mounts **automatically** based on the agent's configuration — you don't add them to the `tools` list yourself. When you pass a `knowledgebase` to the agent, VeADK mounts the `load_knowledgebase` tool. The agent decides on its own when to query the knowledge base and which keywords to search with, then uses the retrieved knowledge as context for its answer.

For backend types, initialization, and data ingestion, see the [knowledge base docs](/productions/veadk/preview/en/components/knowledge).

## Prerequisites

Install `python -m pip install "veadk-python[extensions]"`, then configure the [model](/productions/veadk/preview/en/components/agent/model) and [local backend](/productions/veadk/preview/en/components/knowledge/local). Local storage still sends text to the configured embedding service. Ingest data before the first search.

## Usage

```python lines theme={null}
import asyncio
from veadk import Agent, Runner
from veadk.knowledgebase import KnowledgeBase

knowledgebase = KnowledgeBase(backend="local", index="company_faq")
assert knowledgebase.add_from_text("Employees have 15 days of annual leave after one year of service")
agent = Agent(
    name="kb_agent",
    instruction="Call load_knowledgebase to retrieve the leave policy before answering.",
    knowledgebase=knowledgebase,
)
runner = Runner(agent=agent)

async def main():
    print(await runner.run("How many days of annual leave do employees receive?"))

asyncio.run(main())
```

## Notes

<Note>
  System tools are managed by the framework: just provide a `knowledgebase` — you don't add `load_knowledgebase` to the `tools` list yourself. The agent decides when to call it based on its instruction and user input.
</Note>

## Retrieval input and checks

| Parameter | Type | Default | Description |
| :- | :- | :- | :- |
| `query` | `str` | Required | Search terms or question generated by the agent |
| `tool_context` | `ToolContext` | Injected | Current invocation context, not supplied by the model |

The `knowledges` list contains retrieved knowledge entries. The expected answer includes the 15-day annual leave policy. Passing a user ID does not automatically enforce document permissions; multitenant applications must restrict which knowledge base and data are bound to each request.

The model still decides whether to call the tool. If the answer does not reflect the data, inspect tool events and retrieval results. If direct retrieval fails, check ingestion, embedding configuration, and backend permissions first.
