Knowledge Base (RAG)
Knowledge bases let your voice agents answer questions using your own data — product catalogs, FAQs, policies, pricing sheets, and more. Powered by Retrieval-Augmented Generation (RAG), your agent searches your knowledge base in real-time during calls to give accurate, contextual answers.How It Works
Upload documents
Add your content — PDFs, text files, web pages, or raw text. Agni splits them into searchable chunks automatically.
Index & embed
Documents are processed into vector embeddings for semantic search. This happens automatically after upload.
Connect to agent
Attach the knowledge base to your agent. The agent will search it whenever a caller asks a relevant question.
Creating a Knowledge Base
Via Dashboard
- Navigate to your Agent → open the agent builder
- Find the Knowledge Base section
- Upload documents or paste text content
- The system indexes your content automatically
- Save — your agent now has access to this knowledge
Via API
cURL
Content Best Practices
Use Q&A format
Structure content as questions and answers. This matches how callers ask questions and improves retrieval accuracy.
Keep chunks focused
Each document should cover one topic. A 500-word FAQ works better than a 10,000-word manual.
Include context
Don’t just list facts — include enough context for the agent to form natural responses.
Update regularly
Stale information leads to wrong answers. Set a schedule to refresh your knowledge base.
Example: Good vs Bad Content
Bad (too terse):Querying the Knowledge Base
You can also query the knowledge base programmatically:cURL
Managing Documents
| Action | API Endpoint | Description |
|---|---|---|
| Upload | POST /api/v1/rag/documents | Add or update a document |
| Get | GET /api/v1/rag/documents/{id} | Retrieve a specific document |
| List | GET /api/v1/rag/documents | List all documents |
| Query | POST /api/v1/rag/query | Search the knowledge base |
| Refresh | POST /api/v1/rag/refresh | Re-index all documents |
| Discover | POST /api/v1/rag/discover | Auto-discover content from URLs |
URL Discovery
Automatically crawl and index content from your website:cURL
Exclusions
Control what gets indexed by managing exclusions:cURL
Tips for Better Retrieval
Agent finds wrong information
Agent finds wrong information
Your documents may be too broad. Split large documents into focused topics. Each document should cover one subject area.
Agent says 'I don't have that information'
Agent says 'I don't have that information'
The content may not match how callers phrase their questions. Add multiple phrasings of common questions to your knowledge base.
Responses are too generic
Responses are too generic
Add more specific content. Include exact product names, numbers, dates, and policies. The more concrete your knowledge base, the better the answers.
Knowledge base is outdated
Knowledge base is outdated
Use the refresh endpoint to re-index after updates. Set up a recurring workflow to refresh knowledge bases weekly or after content changes.

