Knowledge
Build knowledge bases from basic RAG through production patterns, vector databases, and cloud storage integrations.
Examples for giving agents searchable knowledge, ordered from a first RAG agent to production deployment.
Getting Started
| Example | Description |
|---|---|
| Basic RAG | Context injection, the simplest way to give an agent access to documents. |
| Agentic RAG | The agent gets a search_knowledge_base tool and decides when to query. |
| Website Per Page | Ingest sitemap pages with per-page content records. |
| Loading Content | Load from local files, URLs, raw text, topics, and batch operations. |
Building Blocks
| Example | Description |
|---|---|
| Chunking Strategies | Side-by-side comparison of document splitting strategies. |
| Search Types | Vector, keyword, and hybrid search compared. |
| Reranking | Score and reorder retrieved candidates with Cohere. |
| Knowledge-Level Reranking | Rerank a widened candidate pool with a reranker on Knowledge. |
| MMR: Diverse Search Results | Reduce near-duplicate chunks with MMR over Qdrant. |
| MMR With PgVector | Apply MMR to PgVector hybrid search results. |
| MMR With Elasticsearch | Apply MMR to Elasticsearch hybrid search results. |
| Recency Boost | Rank recently stored documents higher with PgVector timestamps. |
| Filtering | Narrow search results with document metadata. |
| Agentic Filtering | The agent builds metadata filters from the user query. |
| Embedders | Choose and configure embedding models. |
Production
| Example | Description |
|---|---|
| Multi-Source RAG | Combine PDFs, web pages, and text in one knowledge base. |
| Knowledge Lifecycle | Insert, skip existing content, and remove vectors; track records separately. |
| Multi-Tenant | Isolate per-tenant data with isolate_vector_search. |
| AgentOS | Serve agents and knowledge as API endpoints. |
| Error Handling | Ingestion patterns that survive bad files and failed loads. |
| SSRF Hardening | Restrict URL-fetching readers with allowed_hosts. |
Advanced
| Example | Description |
|---|---|
| Custom Retriever | Full control over retrieval logic, bypassing the Knowledge class. |
| Custom Chunking | Implement your own chunking strategy. |
| Graph RAG | Build a knowledge graph from documents with LightRAG. |
| Knowledge Tools | Think, search, and analyze tools for reasoning over knowledge. |
| Knowledge Protocol | Custom knowledge sources via the KnowledgeProtocol interface. |
| Prefix Search | Search-as-you-type matching on partial words. |
Integrations
Cloud
| Example | Description |
|---|---|
| AWS | Load files and folders from S3 buckets. |
| Azure | Load from Azure Blob Storage containers. |
| Azure (SAS Token) | Blob Storage access with SAS token authentication. |
| GCP | Load from Google Cloud Storage buckets. |
| SharePoint | Load from SharePoint document libraries. |
| GitHub Dynamic Repo | Override the source repository per request. |
| Multi-Source | Combine multiple remote sources in one Knowledge instance. |
RAG
| Example | Description |
|---|---|
| Agentic RAG with Infinity Reranker | Agentic RAG with an Infinity reranker backend. |
| Agentic RAG with LightRAG | Agentic RAG backed by LightRAG. |
| Local RAG with LangChain and Qdrant | Local inference and storage after source and model downloads. |
Readers
| Example | Description |
|---|---|
| Documents | PDF auto-detection and explicit Excel reading. |
| Data | CSV and JSON readers. |
| Web | Website crawling and a PDF URL. |
| Docling: PDF | PDF processing with different output formats. |
| Docling: Office Documents | Microsoft Office document processing. |
| Docling: Images | OCR for image files. |
| Docling: Audio | Speech-to-text transcription for audio files. |
| Docling: Markup | Markup and structured document formats. |
| Docling: Data Files | Spreadsheet and data file processing. |
| Docling: Input Types | Paths, URL strings, and file-like input. |