PAIR-Systems-Inc/Agentic_RAG_GoodMem

GoodMem adaptation of Agentic_RAG: four LangGraph notebooks, runnable CLI, live validation, and integration findings.

0

stars

27

commits

Python

primary language

Sep 14, 2026

updated

README

Agentic RAG with GoodMem

Build a documentation assistant that decides when to search, which sources to consult, and whether it needs another lookup before answering. These four Python notebooks teach agentic retrieval-augmented generation (RAG), from a single LangGraph node to an agent that answers questions across the LangGraph and LangChain documentation, with links to its sources.

Adapted from Chandula Senevirathna's Agentic_RAG, with GoodMem providing document storage and search.

What you'll learn

NotebookWhat you'll build and why
1 — LangGraph StarterStart with one function that calls an LLM, then run two functions in parallel. Learn how state carries information between steps and how reducers combine their updates.
2 — Conditional RoutingClassify a question and send it down one of two paths. This introduces conditional edges: choosing the next step based on what has happened so far.
3 — Agentic RAGGive an agent two documentation search tools. Follow an explicit graph that retrieves passages, checks their relevance, drafts an answer, and searches again when something is missing.
4 — ReAct Multi-hop RAGSolve the same problem with LangChain's prebuilt agent loop. Compare its decisions with the explicit grading and rewriting steps in notebook 3.

Start at notebook 1 if you're new to LangGraph. If you already know the basics, compare notebooks 3 and 4. Both include a question where the first search reveals what to look up next—that dependent second search is what makes it multi-hop.

What GoodMem changes

The original stores documents in Chroma and computes embeddings locally with BGE-M3. Here, GoodMem stores the documentation, splits it into searchable passages, and handles embeddings, search, and optional reranking. Both agents reuse the stored documents across runs.

flowchart LR
  Q[Your question] --> A[Agent]
  A -->|Search| G[GoodMem]
  G -->|Passages and sources| A
  A --> O[Answer with sources]

Set up the project

You'll need Git, Python 3.11+, uv, and a Cohere API key. One key covers the chat, embedding, and reranking API calls in this setup.

For notebooks 3–4 and the retrieval demo, also install and start Docker Desktop, or use Docker Engine with Compose. Notebooks 1–2 need only the chat configuration; you can start them without Docker or GoodMem.

In a terminal:

git clone https://github.com/PAIR-Systems-Inc/Agentic_RAG_GoodMem.git
cd Agentic_RAG_GoodMem
uv sync --locked
cp .env.example .env

On Windows, use PowerShell; Copy-Item .env.example .env also works for the copy step. uv sync creates the project's Python environment and installs its dependencies.

Open .env and replace these values:

COHERE_API_KEY=your-cohere-key
CHAT_PROVIDER=cohere
CHAT_MODEL=command-a-03-2025

You can now open notebooks 1–2. For the retrieval examples, continue below. If you already run GoodMem or prefer Groq for chat, see other configurations.

Ask your first question

From the project folder, start GoodMem and load the six documentation pages:

docker compose up -d --wait
uv run goodmem-rag setup --init --with-reranker

Use --init for the first setup of a new server. When setup prints Ready: 6 documents in 2 spaces., ask a question:

uv run goodmem-rag ask "What is a checkpointer used for in LangGraph? Cite the docs."

An excerpt from a recorded answer:

When a graph is compiled with a checkpointer, LangGraph can save the state of the graph at various points, allowing for resumption of execution if it is interrupted or needs to be retried.

Source: LangGraph Graph API overview

The command also prints the searches the agent made, so you can follow how it reached its answer. Try a question that needs both collections:

uv run goodmem-rag ask "Compare LangGraph StateGraph with the LangChain agent loop. Cite both docs."

The default is the ReAct agent from notebook 4. Add --agent graph to try notebook 3's explicit graph with the same question.

Reranking is optional: omit --with-reranker during initial setup to start with plain search. Reranking itself requires no LLM. Stop the local server with docker compose stop; your indexed documents persist. See the running guide for restarting or refreshing them.

Open the notebooks

For JupyterLab, register the project environment as a kernel and launch the browser interface:

uv run python -m ipykernel install --sys-prefix --name goodmem-rag --display-name "GoodMem RAG"
uv run --group notebooks jupyter lab

Open a notebook from the file browser and select the GoodMem RAG kernel.

For VS Code, install the Python and Jupyter extensions, then open this repository's folder. Open a notebook, click Select Kernel, and choose the Python environment in this project's .venv.

Run cells from top to bottom, or use Run All. Each notebook has its own kernel selection; if one works and another reports missing imports, check that both use the project environment.

Explore further

The recorded live validation passed all four notebooks, 16 retrieval checks, and eight agent cases. Answers can vary; this is not a comparison of answer quality against the original.

Original work by Chandula Senevirathna. See the preserved license notice and upstream provenance.

Contributors

amin3141

5 commits

PAIR-Systems-Inc/Agentic_RAG_GoodMem

GoodMem adaptation of Agentic_RAG: four LangGraph notebooks, runnable CLI, live validation, and integration findings.

0

stars

27

commits

Python

primary language

Sep 14, 2026

updated

README

Agentic RAG with GoodMem

Build a documentation assistant that decides when to search, which sources to consult, and whether it needs another lookup before answering. These four Python notebooks teach agentic retrieval-augmented generation (RAG), from a single LangGraph node to an agent that answers questions across the LangGraph and LangChain documentation, with links to its sources.

Adapted from Chandula Senevirathna's Agentic_RAG, with GoodMem providing document storage and search.

What you'll learn

NotebookWhat you'll build and why
1 — LangGraph StarterStart with one function that calls an LLM, then run two functions in parallel. Learn how state carries information between steps and how reducers combine their updates.
2 — Conditional RoutingClassify a question and send it down one of two paths. This introduces conditional edges: choosing the next step based on what has happened so far.
3 — Agentic RAGGive an agent two documentation search tools. Follow an explicit graph that retrieves passages, checks their relevance, drafts an answer, and searches again when something is missing.
4 — ReAct Multi-hop RAGSolve the same problem with LangChain's prebuilt agent loop. Compare its decisions with the explicit grading and rewriting steps in notebook 3.

Start at notebook 1 if you're new to LangGraph. If you already know the basics, compare notebooks 3 and 4. Both include a question where the first search reveals what to look up next—that dependent second search is what makes it multi-hop.

What GoodMem changes

The original stores documents in Chroma and computes embeddings locally with BGE-M3. Here, GoodMem stores the documentation, splits it into searchable passages, and handles embeddings, search, and optional reranking. Both agents reuse the stored documents across runs.

flowchart LR
  Q[Your question] --> A[Agent]
  A -->|Search| G[GoodMem]
  G -->|Passages and sources| A
  A --> O[Answer with sources]

Set up the project

You'll need Git, Python 3.11+, uv, and a Cohere API key. One key covers the chat, embedding, and reranking API calls in this setup.

For notebooks 3–4 and the retrieval demo, also install and start Docker Desktop, or use Docker Engine with Compose. Notebooks 1–2 need only the chat configuration; you can start them without Docker or GoodMem.

In a terminal:

git clone https://github.com/PAIR-Systems-Inc/Agentic_RAG_GoodMem.git
cd Agentic_RAG_GoodMem
uv sync --locked
cp .env.example .env

On Windows, use PowerShell; Copy-Item .env.example .env also works for the copy step. uv sync creates the project's Python environment and installs its dependencies.

Open .env and replace these values:

COHERE_API_KEY=your-cohere-key
CHAT_PROVIDER=cohere
CHAT_MODEL=command-a-03-2025

You can now open notebooks 1–2. For the retrieval examples, continue below. If you already run GoodMem or prefer Groq for chat, see other configurations.

Ask your first question

From the project folder, start GoodMem and load the six documentation pages:

docker compose up -d --wait
uv run goodmem-rag setup --init --with-reranker

Use --init for the first setup of a new server. When setup prints Ready: 6 documents in 2 spaces., ask a question:

uv run goodmem-rag ask "What is a checkpointer used for in LangGraph? Cite the docs."

An excerpt from a recorded answer:

When a graph is compiled with a checkpointer, LangGraph can save the state of the graph at various points, allowing for resumption of execution if it is interrupted or needs to be retried.

Source: LangGraph Graph API overview

The command also prints the searches the agent made, so you can follow how it reached its answer. Try a question that needs both collections:

uv run goodmem-rag ask "Compare LangGraph StateGraph with the LangChain agent loop. Cite both docs."

The default is the ReAct agent from notebook 4. Add --agent graph to try notebook 3's explicit graph with the same question.

Reranking is optional: omit --with-reranker during initial setup to start with plain search. Reranking itself requires no LLM. Stop the local server with docker compose stop; your indexed documents persist. See the running guide for restarting or refreshing them.

Open the notebooks

For JupyterLab, register the project environment as a kernel and launch the browser interface:

uv run python -m ipykernel install --sys-prefix --name goodmem-rag --display-name "GoodMem RAG"
uv run --group notebooks jupyter lab

Open a notebook from the file browser and select the GoodMem RAG kernel.

For VS Code, install the Python and Jupyter extensions, then open this repository's folder. Open a notebook, click Select Kernel, and choose the Python environment in this project's .venv.

Run cells from top to bottom, or use Run All. Each notebook has its own kernel selection; if one works and another reports missing imports, check that both use the project environment.

Explore further

The recorded live validation passed all four notebooks, 16 retrieval checks, and eight agent cases. Answers can vary; this is not a comparison of answer quality against the original.

Original work by Chandula Senevirathna. See the preserved license notice and upstream provenance.

See what people are saying

Contributors

amin3141

5 commits

Languages

Python

54.5%

Jupyter Notebook

45.5%