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

# Knowledge Bases

> What are knowledge bases in AI Agents?

Knowledge Bases are sources of information that expand an agent's memory and context, ensuring that the agent has access to reliable and domain-specific data.

A knowledge base can contain internal documents, FAQs, technical articles, historical records, spreadsheets, manuals, or even web pages.

## How Agents Use Knowledge Bases

* An agent can consume a knowledge base in various ways:\
  Context retrieval: when a user's question is asked, the agent searches the knowledge base for relevant excerpts.
* Integration with the model: the retrieved content is injected into the AI model's prompt.
* Evidence-based response: the model generates the output by combining natural language with data from the base.
* Multimodal support: depending on the configuration (multimodal: true), the base can contain not only text but also images, audio, and video.

### Types of Knowledge Bases:

* file: documents such as PDFs, spreadsheets, or presentations.
* url: links to internal or external websites.
* text: direct blocks of structured knowledge.

### Best Practices

* Use tags to organize and allow the agent to perform quick searches (e.g.: \["finance", "contracts"]).
* Security: restrict access by sectors to prevent leakage of sensitive information.
* Selective enabling: control the enabled status to activate/deactivate bases depending on the environment or project.

### Orkeia Knowledge Base Interface

Orkeia allows, via API, to pass knowledge bases to our agents, below is an example of the interface:

```typescript theme={null}
export interface KnowledgeBase {
  id?: string;
  name: string;
  description: string;
  enabled: boolean;
  sectors: string[];
  content: string;
  type: 'file' | 'url' | 'text';
  multimodal: boolean;
  tags: string[];
}
```

### Example of Orkeia Knowledge Base JSON

```json theme={null}
{
  "id": "kb_internal_policies",
  "name": "Internal Policies",
  "description": "Knowledge base with company regulations, policies, and internal procedures.",
  "enabled": true,
  "sectors": ["hr", "legal", "management"],
  "content": "https://storage.orkeia.ai/kb/policies.pdf",
  "type": "file",
  "multimodal": false,
  "tags": ["compliance", "employee-handbook", "contracts"]
}
```
