DEV.co
RAG Frameworks · NirDiamant

Controllable-RAG-Agent

Controllable-RAG-Agent is an open-source Python framework for building advanced Retrieval-Augmented Generation systems that answer complex questions from custom documents using a graph-based agentic approach. It combines document processing, vector retrieval, multi-step reasoning, and hallucination prevention to deliver grounded answers without relying on pre-trained model knowledge.

Source: GitHub — github.com/NirDiamant/Controllable-RAG-Agent
1.6k
GitHub stars
264
Forks
Jupyter Notebook
Primary language
Apache-2.0
License (OSI-approved)

Key facts

Objective fields from the source. Values we can't verify are shown as “Unknown” rather than guessed.

FieldValue
RepositoryNirDiamant/Controllable-RAG-Agent
OwnerNirDiamant
Primary languageJupyter Notebook
LicenseApache-2.0 — OSI-approved
Stars1.6k
Forks264
Open issues4
Latest releaseUnknown
Last updated2026-06-04
Sourcehttps://github.com/NirDiamant/Controllable-RAG-Agent

What Controllable-RAG-Agent is

Built on LangChain/LangGraph with FAISS vector stores, the system uses deterministic graph-based planning to decompose queries into sub-tasks, anonymizes questions to reduce model bias, retrieves and distills relevant content, and applies chain-of-thought reasoning with self-verification (inspired by Self-RAG). Supports flexible LLM backends (OpenAI, Groq) and includes Ragas-based evaluation metrics.

Quickstart

Get the Controllable-RAG-Agent source

Clone the repository and explore it locally.

terminalbash
git clone https://github.com/NirDiamant/Controllable-RAG-Agent.gitcd Controllable-RAG-Agent# follow the project's README for install & configuration

Need it deployed, integrated, or customized instead? DEV.co ships production installs.

Best use cases

Document-Heavy Q&A Systems

Organizations with large proprietary document collections (books, manuals, research papers) needing fact-grounded answers to complex multi-step questions without hallucination. The Harry Potter use case demonstrates exact knowledge verification.

Enterprise Knowledge Bases

Internal knowledge retrieval for customer support, legal/compliance review, or domain-specific research where answer traceability and content grounding are critical. Multi-step reasoning handles nuanced queries across interconnected documents.

AI Agent Development & Prototyping

Teams building controllable autonomous agents need a reference architecture for orchestrating retrieval, planning, and execution. The graph-based design provides visibility and control over agent behavior versus black-box LLM calls.

Implementation considerations

  • LLM API costs scale with document volume (summarization step) and query complexity (multi-step reasoning). Budget for token usage across all planning, retrieval, and generation phases.
  • Vector store size depends on document preprocessing strategy (chunk size, overlap, summary inclusion). FAISS is in-memory; validate RAM requirements for large corpora before production.
  • Requires tuning anonymization, planning depth, and verification thresholds. No pre-trained defaults provided; experimentation needed to balance accuracy vs. latency for your domain.
  • Error handling and fallback strategies for LLM failures, retrieval misses, or verification failures are not explicitly detailed. Custom error recovery logic needed for production.
  • Evaluation requires labeled datasets and Ragas metrics setup. Without ground-truth Q&A pairs, measuring hallucination prevention and faithfulness is difficult.

When to avoid it — and what to weigh

  • Simple Semantic Search Suffices — If your use case is single-query vector similarity (e.g., FAQ lookup, basic document search), the overhead of planning, anonymization, and multi-step reasoning adds unnecessary complexity.
  • Real-Time Latency-Critical Applications — Multi-step reasoning, summarization, and re-planning introduce non-trivial latency. Not suitable for sub-second response requirements (chatbots, live customer interactions).
  • Unstructured Data Without Clear Boundaries — The approach assumes coherent, parseable documents (PDFs with clear chapters, quotes). Streaming data, semi-structured logs, or highly fragmented content may degrade performance.
  • Minimal DevOps/Infrastructure Expertise — Requires managing vector stores, LLM API keys, Docker orchestration (optional), Streamlit deployment, and monitoring. Not a plug-and-play SaaS—demands engineering overhead.

License & commercial use

Apache License 2.0 (Apache-2.0). Permissive OSI-approved license allowing commercial use, modification, and distribution with attribution and liability disclaimers.

Apache 2.0 permits commercial use and deployment. However, ensure compliance with dependencies (LangChain, FAISS, etc.) and LLM provider terms (OpenAI API, Groq). No warranty or indemnification provided by the project; suitable for internal R&D or commercial products where you accept dependency and model risks.

DEV.co evaluation signals

Editorial assessment — not user reviews. Directional, with an explicit confidence level.

SignalAssessment
MaintenanceActive
DocumentationAdequate
License clarityClear
Deployment complexityHigh
DEV.co fitGood
Assessment confidenceHigh
Security considerations

Requires secure storage of LLM API keys (env variables via .env file). No explicit encryption, access control, or audit logging documented. Vector store and processed documents are unencrypted by default. Suitable for internal/research use; for production with sensitive data, implement encryption at rest, key management, and access controls independently. No vulnerability disclosure or security policy stated.

Alternatives to consider

LangChain RetrievalQA / LangGraph workflows

Both are core dependencies here. RetrievalQA is simpler for basic RAG; LangGraph offers lower-level orchestration but requires more custom code. This repo provides a reference implementation combining both.

Llama-Index (formerly GPT Index)

Higher-level RAG framework with query engines, node post-processors, and evaluation tools built-in. Less transparent control over graph logic; better for rapid prototyping, less suitable for research/understanding agent internals.

Haystack (Deepset)

Production-grade RAG framework with retrieval pipelines, hybrid search, and evaluation utilities. More mature and scalable; higher learning curve; better suited for teams with existing Haystack expertise or needing advanced document processing.

Software development agency

Build on Controllable-RAG-Agent with DEV.co software developers

Explore Controllable-RAG-Agent to prototype advanced retrieval agents. Perfect for teams evaluating agentic RAG architectures or building knowledge-grounded AI systems. Review the code, test with your documents, and extend the design for production use.

Talk to DEV.co

Related open-source tools

Surfaced by semantic similarity across the DEV.co open-source index.

Related on DEV.co

Explore the category and the services that help you build with it.

Controllable-RAG-Agent FAQ

Can I use local LLMs instead of OpenAI/Groq?
The codebase is built for OpenAI/Groq APIs. Using local models (Ollama, LLaMA) requires custom LLM adapter code in the planning and reasoning steps. Requires review of the LangChain LLM interface to confirm compatibility.
What document formats are supported?
Currently, PDFs are demonstrated. The code loads PDFs and splits by chapters. Other formats (Word, HTML, Markdown) would require custom loaders before the pipeline. Not clearly stated in docs.
How does this prevent hallucinations?
Via content verification step (Self-RAG inspired) and distillation of retrieved context before generation. Grounding is enforced by breaking down questions and checking if answers reference the retrieved documents. Effectiveness depends on tuning and quality of source data.
Is this suitable for production?
As a reference architecture and research project, yes. As a drop-in library, no. Requires custom error handling, monitoring, cost tracking, security hardening, and performance tuning. Best used as a learning resource to build custom production systems.

Software development & web development with DEV.co

DEV.co is a software development agency delivering custom software development services to companies building on open source. Our software developers and web developers design, integrate, and ship production systems — spanning web development, APIs, AI, data, and cloud. If Controllable-RAG-Agent is part of your rag frameworks roadmap, our team can implement, customize, migrate, and maintain it.

Build Intelligent Document Q&A Systems

Explore Controllable-RAG-Agent to prototype advanced retrieval agents. Perfect for teams evaluating agentic RAG architectures or building knowledge-grounded AI systems. Review the code, test with your documents, and extend the design for production use.