Controllable Complex RAG

Plans, retrieves, and verifies answers to complex multi-step questions over your own documents.

Stars
★ 1.6k
Last updated
1mo ago
FARS reviewed
Nov 08, 2026
License
Apache-2.0
Primary language
Jupyter Notebook

At a glance

How it runs
Library / SDKSelf-hosted serviceWeb app
Works with
Universal · cross-platformOpenAI API
Cost
Free software; you pay for model usage
Setup effort
Medium · a few setup steps
You'll need
Python 3.8+LLM provider API keyLangChainFAISS Vector StoreStreamlitRagasDocker and Docker Compose (optional)Shell / CLINetwork accessLocal filesystem
Typical use
A researcher with a long book or PDF collection who must answer questions requiring facts and causal links from several chapters.
Not a fit if
  • Users who want to ask questions directly without PDF chapter summarization and multi-vector-store preprocessing
  • Teams needing a production API with auth, concurrency and monitoring; only a notebook and Streamlit demo are provided
Maintenance
Commits in the last 6 monthslast commit 2026-10-31

What does this agent do, and when should you use it?

This repository implements an advanced RAG workflow for questions that basic semantic-similarity retrieval cannot readily answer. It processes PDFs and builds vector stores from text chunks, LLM-generated chapter summaries, and selected book quotations. A deterministic graph orchestrates question anonymization, planning, task decomposition, retrieval or answering, grounding checks, and iterative re-planning. The final answer is produced from accumulated context, with verification intended to reduce unsupported generation. The project is self-hosted through a Python environment or Docker and exposes a Jupyter tutorial plus a Streamlit visualization rather than a documented production API.

The pipeline loads PDFs, separates them into chapters, cleans their text, and calls an LLM to generate extensive chapter summaries. It encodes book chunks, summaries, and quotations in FAISS Vector Store indexes. For each question, it replaces named entities with variables, creates a high-level plan for the anonymized form, restores the entities, and breaks the plan into retrievable or answerable tasks. Each task either retrieves and distills relevant vector-store content or generates an answer from the available context; the workflow then checks grounding against the original context and revises the remaining plan. It combines the accumulated material into a final answer. sophisticated_rag_agent_harry_potter.ipynb presents the workflow step by step, simulate_agent.py supplies real-time Streamlit visualization, and Ragas measures answer correctness, faithfulness, relevancy, context recall, and answer similarity.

  1. A researcher with a long book or PDF collection who must answer questions requiring facts and causal links from several chapters.
  2. An ML engineer prototyping internal knowledge QA who wants explicit control over planning, retrieval, answering, verification, and re-planning.
  3. A team evaluating a RAG pipeline that wants Ragas measurements covering correctness, faithfulness, relevancy, context recall, and similarity.
  4. An instructor or learner studying advanced RAG who wants a notebook demonstration of anonymization, decomposition, vector retrieval, and adaptive planning.
  5. A developer presenting an agent workflow who needs a Streamlit interface that visualizes execution in real time.

Key setup facts

Pulled from the install and usage notes below. The project README has the current values.

Install / run
  • pip install -r requirements.txt
Environment variables
OPENAI_API_KEY GROQ_API_KEY
Config files
.env .env.example
Runtime
Python 3.8+
Install notes cover
Docker

How do you install or deploy this agent?

Prerequisites are Python 3.8+ and an API key for the selected LLM provider.

For a local installation:

git clone https://github.com/NirDiamant/Controllable-RAG-Agent.git
cd Controllable-RAG-Agent

Create .env in the repository root, using .env.example as a reference, and fill the applicable provider key:

OPENAI_API_KEY=
GROQ_API_KEY=

Install the packages:

pip install -r requirements.txt

Alternatively, after configuring the environment variables, build and run with Docker:

docker-compose up --build

How do you use this agent?

Open and run sophisticated_rag_agent_harry_potter.ipynb for the step-by-step tutorial. To launch the real-time visualization locally, run:

streamlit run simulate_agent.py

For the Docker deployment, visit http://localhost:8501/ after the container starts. The documented example uses the first Harry Potter book so users can inspect whether answers rely on retrieved evidence rather than pretrained knowledge; applying it to another corpus requires preparing and processing the relevant PDFs. No separate HTTP API, command-line question interface, or production service deployment is documented.

Safety boundaries, hardening & integrations

Operational blast radius, source-verified safety controls, and first-run hardening steps before connecting this agent to real workspaces.

Declared capability surface (blast radius)

Local shell command execution

Can run terminal commands; pair with approval gates or container/OS sandboxing.

Local filesystem read/write

Modifies local files; work on a clean Git branch or dedicated worktree.

Outbound network access

Makes outbound requests; verify telemetry settings and model data routing on private repos.

FARS trust-control audit

Not found in source — apply before daily use
  • rollback or recovery path — Back up first, or work on a git branch or snapshot, so its changes can be undone.

What are this agent's strengths and limitations?

Pros
  • A deterministic graph explicitly controls planning, task execution, verification, and re-planning instead of relying on a single similarity-search pass.
  • It indexes text chunks, chapter summaries, and quotations, giving the retrieval process several representations of the source material.
  • Question anonymization, retrieval distillation, and context-grounding checks directly address pretrained-knowledge bias and unsupported generation.
  • The included Ragas evaluation covers five distinct quality dimensions rather than relying only on demonstrations.
  • A notebook tutorial, Streamlit visualization, and Docker path make the workflow accessible for experimentation and demonstrations.
Limitations
  • The documented workflow centers on book PDFs and one Harry Potter example; there is no evidence of connectors for websites, databases, or continuously changing sources.
  • Generating chapter summaries and maintaining multiple vector stores adds preprocessing time, provider calls, and storage overhead.
  • Execution requires network access and credentials for an external LLM provider; the example environment names only OpenAI and Groq.
  • Authentication, concurrency, monitoring, a persistent service API, and production scaling are not documented, so adopters must supply that engineering.
  • Although flexible LLM integration is claimed, the source provides no provider-by-provider compatibility matrix or description of feature tradeoffs.

How does this agent compare with similar options?

Compared with basic RAG that retrieves passages only by semantic similarity, this project adds question anonymization, high-level planning, task decomposition, retrieval distillation, grounding verification, and adaptive re-planning for non-trivial multi-step questions. That additional control also makes the pipeline more complex and introduces more LLM calls, index preparation, and evaluation work. The README presents RAG_Techniques as a complementary collection of other RAG methods, not as a direct replacement.

Key facts side by side with the most closely related agents.

Agent Source review Form / cost Stars Updated Language Full support on
Controllable Complex RAG This agent 46 · Major gaps Library / SDKFree + model costs ★ 1.6k 1mo ago Jupyter Notebook OpenAI API
AI Engineering Bootcamp 38 · Major gaps FrameworkFree ★ 960 1mo ago Jupyter Notebook —
EgoAlpha Prompt In-Context Learning Guide 35 · Major gaps Library / SDKFree ★ 2.3k 1d ago Jupyter Notebook —
Meta ARE 57 · Major gaps CLIFree + model costs ★ 587 2mo ago Python —

How does FollowAgents rate this agent?

FollowAgents source review · FARS-2.1
Major gaps
46/ 100 5-point scale 2.3 / 5
Trust 12/29
Reliability 5/14
Adaptability 9/18
Convention 10/18
Effectiveness 7/13
Verifiability 3/8
Why each dimension lost points
Trust12 / 29 · 2.1/5

AGENTS.md says API keys should come from the environment, the README says to configure a key for the chosen LLM provider, and the documented workflow shows PDFs, vector stores, and LLMs in the processing path, giving some data-flow visibility. These are limited safeguards: the packet does not show least-privilege controls, detailed key protection, user confirmation, a complete external-call inventory, or recovery. The README also contains promotional links routed through a tracking service. Repository attribution is present, but publisher identity remains unverified under the stated rule.

Reliability5 / 14 · 1.8/5

Dependencies are pinned, and the CI workflow explicitly checks notebook and Python syntax without executing code, offering limited support for dependency reproducibility and syntax integrity. The README claims a deterministic graph with verification and replanning, but its descriptions vary between generic LangChain RAG and LangGraph; no error handling or user-facing failure messages are shown, so points are deducted.

Adaptability9 / 18 · 2.5/5

The material targets users applying complex question answering to their own PDFs, with a Harry Potter example, a multi-step workflow, and several listed LLM options. Document formats and scenarios remain centered on PDFs and that example; supported boundaries and failure cases are thin, and the claim of compatibility with any LangChain-compatible provider lacks implementation detail.

Convention10 / 18 · 2.8/5

The repository guide maps key files to their roles, while the README provides a tutorial, run instructions, an example, and an FAQ. The Apache-2.0 license text is present, and the author and contribution channels are identified. Installation numbering and the Docker versus non-Docker sequence are unclear; known limitations and a clear change history are not shown, so points are deducted.

Effectiveness7 / 13 · 2.7/5

The described design decomposes tasks, uses vector stores at different granularities, and checks retrieval relevance and answer grounding, which could help with multi-hop questions. Effect and hallucination-prevention claims are not substantiated by results in the supplied material. Summarization, multiple indexes, and LLM calls also imply added running cost, with no cost or latency discussion.

Verifiability3 / 8 · 1.9/5

The README, repository guide, dependency list, and CI workflow corroborate some claims about layout, usage, and the scope of syntax checks. Core capability and evaluation claims are largely self-reported; the packet contains no main implementation source, evaluation results, or independent corroboration. Fact and promotional inference are only weakly separated, so points are deducted.

Risks and how to mitigate them
  • Not found in source: rollback or recovery pathBack up first, or work on a git branch or snapshot, so its changes can be undone.
  • The documented workflow uses external LLM providers and requires API keys; before using private PDFs, review the provider's data handling terms and whether sensitive content will be sent to an external service.
  • Claims about determinism, accuracy, and hallucination prevention are not supported by run results in this packet; CI performs syntax compilation checks only, not answer-quality validation.
  • Docker and non-Docker installation steps are numbered unclearly, and the supplied material gives no cost, latency, or known-limitations details.
Evidence confidence: Low Reviewed Nov 08, 2026 Reviewed revision 6c49dd36f553
See the full review method →
Maintain this project? Add the FARS badge to your README

The badge shows the current review score and verdict and links back to this page. It refreshes about once an hour after a re-review.

FARS

[![FARS review](https://followagents.com/badge/controllable-rag-agent.svg)](https://followagents.com/en/agents/controllable-rag-agent)
<a href="https://followagents.com/en/agents/controllable-rag-agent"><img src="https://followagents.com/badge/controllable-rag-agent.svg" alt="FARS review"></a>

FAQ

Is OpenAI required?
No. The repository describes flexible use of OpenAI GPT models, Groq, or other LLMs, while its example environment lists OPENAI_API_KEY and GROQ_API_KEY. Configuration instructions for additional providers are not supplied.
Does it guarantee hallucination-free answers?
It verifies generated content against original context and evaluates faithfulness with Ragas. These mechanisms are intended to prevent or detect unsupported output, but the source provides neither an absolute guarantee nor measured failure rates.
Is there a ready-made chat API?
None is documented. The stated entry points are the Jupyter notebook, streamlit run simulate_agent.py, and the Docker-hosted Streamlit page.
What drives operating cost?
The selected provider may be called for chapter summarization, planning, task execution, verification, and final answer generation. The repository gives no pricing, token-usage figures, or hardware benchmarks.
Is it ready for production deployment?
It is well suited to advanced-RAG experimentation, teaching, and prototyping. Production authentication, concurrency, monitoring, service-level behavior, and scaling are not documented and would require additional work.
Was this page helpful?
View on GitHub ↗ Install ↓

Related concepts