
MongoDB RAG Agent
https://github.com/coleam00/MongoDB-RAG-Agent- Category
- AI Agents
- Rank
- No. 1555Tools index
- Pricing
- Open Source
- Type
- AGENT
- Builder
- coleam00
- GitHub
- 115 stars
- Date
About
Hybrid RAG AI agent built with MongoDB, Pydantic AI, and Docling — combines semantic and text search with reciprocal rank fusion.
What it does
It turns a folder of business documents and audio into a terminal knowledge assistant. The ingestion pipeline converts content, preserves headings and structure when possible, creates embeddings, and stores documents and chunks in MongoDB Atlas. Users then ask questions through a streaming conversational interface that shows search activity and retains message history.
Why it's ranked here
This is a useful, readable reference implementation for teams already considering MongoDB Atlas. It covers ingestion, retrieval, model configuration, and conversation instead of stopping at a search demo. The verdict is mixed because Atlas indexes require manual setup, provider credentials are mandatory, and several configuration details do not match their use in code.
What's good
The ingestion surface is unusually broad: office files, PDFs, HTML, Markdown, text, and common audio formats. Structure-aware chunking includes heading context, with a sentence-aware sliding-window fallback. Vector and fuzzy text queries run concurrently, and duplicate chunks gain combined relevance through rank fusion. Search limits are capped, credentials are masked during configuration checks, and the terminal exposes tool activity.
Tradeoffs
Setup requires MongoDB Atlas, separate search indexes, model credentials, embedding credentials, and UV. The index example fixes vectors at 1,536 dimensions, so changing embedding models also demands index changes. Search failures often become empty results, which can hide infrastructure faults. A new database connection is opened for each agent search. The prompt names retrieval choices differently from the single tool actually exposed to the model.
How to use it well
Use it as a Python starting point for an internal, terminal-based assistant over mixed document collections, especially when MongoDB Atlas is already acceptable infrastructure. Validate configuration, ingest representative files, create both indexes, then test retrieval quality before tuning chunk and result limits. It does not provide a web interface, hosted service, access-control layer, or documented public API.
Technical notes+
pyproject.toml defines Python 3.10+, setuptools packaging, UV development dependencies, and no console-script entry point. src/ingestion/ingest.py converts supported files, transcribes audio, chunks content, embeds batches, and writes to Atlas. src/tools.py implements $vectorSearch, fuzzy $search, and manual RRF; both retrieval branches return empty lists on operational errors. src/agent.py exposes only search_knowledge_base, while src/prompts.py tells the model to use hybrid_search, creating a naming mismatch. src/providers.py configures get_embedding_model with LLM base URL and credentials rather than the dedicated embedding settings. src/dependencies.py correctly uses the dedicated embedding configuration. src/cli.py supplies the interactive streaming interface and keeps Pydantic AI message history.
Observed
- Primary language
- Python
- Runtime requirement
- Python 3.10 or newer
- Packaging and install surface
- Setuptools project managed through UV; dependencies are declared in pyproject.toml
- Interface
- Interactive Rich terminal CLI; no web interface or documented public API is shown
- Database platform
- MongoDB Atlas with Vector Search and Atlas Search; the README states the M0 free tier is supported
- Repository structure
- A src package, PostgreSQL reference examples, sample documents, a configuration validator, and a standalone end-to-end test script are listed
Read from README.md, pyproject.toml, src/cli.py, src/__init__.py, src/agent.py, src/tools.py, src/prompts.py, src/settings.py, src/providers.py, src/test_config.py, src/dependencies.py, src/ingestion/ingest.py, src/ingestion/chunker.py, src/ingestion/__init__.py, src/ingestion/embedder.py.
What it can do
Perform semantic search on documents
Natural language query → Semantically relevant document chunks
Execute text-based keyword search
Search terms or keywords → Documents containing matching text
Combine search results using reciprocal rank fusion
Multiple ranked search result lists → Single unified ranked result list
Generate AI responses from retrieved context
User query and retrieved document context → Contextual AI-generated answer
Process and index documents for retrieval
Documents in various formats → Searchable document embeddings and metadata stored in MongoDB
Extract and structure document content
Raw documents → Structured document data with validated schema
Tags
Tech Stack
Comments (0)
No comments yet
Editorially curated, with community endorsements as a secondary signal. Corrections welcome.