> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.levrage.ai/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.levrage.ai/_mcp/server.

# Knowledge Base

> Give your voice agents domain expertise

Give your AI agents deep domain knowledge so they can answer product-specific questions, follow company policies, and provide accurate information during calls.

## How It Works

Levrage.AI agents use a **knowledge base** to ground their responses in facts you provide. Instead of relying solely on their training data, agents reference your knowledge base to answer questions accurately and consistently.

There are two ways to provide knowledge:

| Method                    | Best For                                                  | Field             |
| ------------------------- | --------------------------------------------------------- | ----------------- |
| **Typed Knowledge**       | Quick text-based knowledge (FAQs, policies, product info) | `typed_knowledge` |
| **Knowledge Base Upload** | Large documents (PDFs, manuals, catalogs)                 | Dashboard upload  |

## Typed Knowledge

Pass knowledge directly when creating or updating an agent:

**`Python`**

```python Python
import requests

response = requests.post(
    "https://api.levrage.ai/v1/agents",
    headers={"Authorization": f"Bearer {API_KEY}"},
    json={
        "name": "Product Support Agent",
        "agent_type": "support",
        "language": "English",
        "voice": "female",
        "start_flow": "Hello! How can I help you today?",
        "end_flow": "Thanks for calling! Have a great day.",
        "typed_knowledge": """
COMPANY: Acme Electronics
RETURN POLICY: 30-day returns on all products. Items must be unused and in original packaging.
WARRANTY: 1-year manufacturer warranty on all electronics. Extended warranty available for $49/year.

PRODUCTS:
- SmartWatch Pro: ₹12,999 — GPS, heart rate, 7-day battery
- AirPods Ultra: ₹8,499 — Active noise cancellation, 24hr battery
- PowerBank 20K: ₹2,499 — 20,000mAh, fast charging, USB-C

STORE HOURS: Mon-Sat 10AM-8PM, Sun 11AM-6PM
SUPPORT EMAIL: support@acme-electronics.com
SUPPORT PHONE: +91 1800-123-4567 (toll-free)
        """
    }
)
```

**`cURL`**

```bash cURL
curl -X POST https://api.levrage.ai/v1/agents \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Product Support Agent",
    "agent_type": "support",
    "language": "English",
    "voice": "female",
    "start_flow": "Hello! How can I help you today?",
    "end_flow": "Thanks for calling! Have a great day.",
    "typed_knowledge": "COMPANY: Acme Electronics\nRETURN POLICY: 30-day returns on all products.\nPRODUCTS:\n- SmartWatch Pro: ₹12,999\n- AirPods Ultra: ₹8,499\n..."
  }'
```

## Updating Knowledge

Update an agent's knowledge base at any time:

```bash
curl -X PATCH https://api.levrage.ai/v1/agents/{agent_id} \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "typed_knowledge": "Updated product catalog and policies..."
  }'
```

> **Tip**
>
> You can update `typed_knowledge` without affecting any other agent settings — only the fields you send will change.

## Writing Effective Knowledge

### Do

* **Structure with clear headings** — Use labels like `POLICY:`, `PRODUCT:`, `FAQ:`
* **Include specific numbers** — Prices, dates, limits, measurements
* **Cover common questions** — Think about what customers will ask
* **Keep it factual** — Avoid opinions or marketing language
* **Update regularly** — Stale knowledge leads to wrong answers

### Don't

* **Don't paste entire websites** — Curate the most relevant information
* **Don't include internal jargon** — Agents will repeat what you give them
* **Don't add contradictory info** — The agent may get confused
* **Don't write instructions here** — Use the prompt field for behavior instructions

## Example: Real Estate Agent Knowledge

```text
COMPANY: Dream Homes Real Estate
LOCATION: Mumbai, Maharashtra

AVAILABLE PROPERTIES:
1. Sea View Apartment, Worli
   - 3 BHK, 1,450 sq ft
   - Price: ₹3.2 Cr
   - Amenities: Pool, gym, parking, 24/7 security
   - Ready to move

2. Garden Villa, Powai
   - 4 BHK, 2,800 sq ft
   - Price: ₹5.5 Cr
   - Amenities: Private garden, clubhouse, EV charging
   - Possession: June 2026

PAYMENT: EMI options available via HDFC, ICICI, SBI
SITE VISITS: Available Mon-Sun, 10AM-6PM
CONTACT: Rahul Mehta (Senior Sales Manager) — +91 98765 43210
```

## Knowledge Base via Dashboard

For large documents (PDFs, manuals, catalogs), upload them through the Dashboard:

1. Go to [Levrage.AI Studio](https://studio.levrage.ai)
2. Select your agent → **Knowledge Base** tab
3. Click **Upload Document**
4. Supported formats: PDF, TXT, DOCX (max 10MB)

The uploaded documents are automatically processed and made available to your agent during calls.

## How Agents Use Knowledge

During a call, when the user asks a question, the agent:

1. **Searches** the knowledge base for relevant information
2. **Extracts** the most relevant facts
3. **Formulates** a natural response using those facts
4. **Cites** specific details (prices, names, policies) accurately

> **Note**
>
> The agent will never hallucinate information that contradicts your knowledge base. If the answer isn't in the knowledge base, the agent will acknowledge it doesn't have that information rather than guessing.