Knowledge & RAG
Document intelligence and RAG with AgenticX.
Knowledge & RAG
Overview
AgenticX provides a complete document intelligence pipeline — from ingestion and chunking to hybrid retrieval and GraphRAG.
Document Ingestion
python
1from agenticx.knowledge import KnowledgeBase23kb = KnowledgeBase(name="my-docs")45# Add documents6kb.add_file("report.pdf")7kb.add_url("https://example.com/article")8kb.add_text("AgenticX is a multi-agent framework...", source="manual")910# Process (chunk, embed, index)11kb.build()
Retrieval
python
1# Vector retrieval2results = kb.search("What are the key features?", top_k=5)34# Hybrid retrieval (vector + BM25)5results = kb.search("key features", mode="hybrid", top_k=10)67# With reranking8results = kb.search("key features", mode="hybrid", rerank=True, top_k=5)
GraphRAG
For complex documents with rich relationships, use GraphRAG:
python
1from agenticx.knowledge import GraphKnowledgeBase23gkb = GraphKnowledgeBase(4 name="research-papers",5 graph_backend="neo4j", # or "nebula"6 neo4j_uri="bolt://localhost:7687"7)89gkb.add_file("research_paper.pdf")10gkb.build() # Extracts entities and relationships1112# Graph-aware retrieval13results = gkb.search("relationship between agent memory and performance")
Giving a Knowledge Base to an Agent
python
1from agenticx.tools import KnowledgeBaseTool23kb_tool = KnowledgeBaseTool(knowledge_base=kb)45executor = AgentExecutor(6 agent=agent,7 llm=llm,8 tools=[kb_tool]9)
Supported Document Formats
| Format | Reader |
|---|---|
| MinerU / PyMuPDF | |
| Word (.docx) | python-docx |
| PowerPoint (.pptx) | python-pptx |
| Markdown | Native |
| HTML | BeautifulSoup |
| CSV / Excel | Pandas |
| Plain text | Native |
Embeddings
python
1from agenticx.embeddings import OpenAIEmbeddings23embeddings = OpenAIEmbeddings(model="text-embedding-3-small")4kb = KnowledgeBase(name="my-docs", embeddings=embeddings)
Supported embedding providers: OpenAI, Bailian, SiliconFlow, LiteLLM.
Vector Stores
| Store | Notes |
|---|---|
| Faiss | Local, fast, no server required |
| Chroma | Local or server mode |
| Qdrant | Production-grade, cloud available |
| Milvus | High-scale enterprise |
| PgVector | PostgreSQL extension |
| Pinecone | Managed cloud |
| Weaviate | Managed cloud with GraphQL |