How amanotooko7/agentrag works
AgentRAG is a single-question research agent: it plans subquestions, generates retrieval queries, gathers evidence, answers each subquestion, reflects on progress, and either continues, replans, or synthesizes a final answer. Retrieval supports a hybrid Wikipedia path and a documented dense Lilian Weng blog path; a separate dense-only Wikipedia implementation is also present. The graph and node excerpts establish the main orchestration; unsampled blog-retriever wiring is not asserted.
Main entry points: graph.py Agent graph · nodes.py Progress reflection · prompts.py Prompt templates · retriever_of_wiki.py Hybrid wiki retriever
Components 19
Agent workflow
- Single-question runner
V2_Py_project/main-singleQ.py - Agent graph
V2_Py_project/src/graph.py - Plan and replan
V2_Py_project/src/nodes.py - Query generation
V2_Py_project/src/nodes.py - Retriever tool dispatch
V2_Py_project/src/graph.py - Subquestion answering
V2_Py_project/src/nodes.py - Progress reflection
V2_Py_project/src/nodes.py - Final synthesis
V2_Py_project/src/nodes.py
Evidence retrieval
- Hybrid wiki retriever
V2_Py_project/src/retriever_of_wiki.py - Dense-only wiki retriever
V2_Py_project/src/retriever_of_wiki_dense_search_only.py - Blog dense retriever
V2_Py_project/src/retriever.py - Document reranker
V2_Py_project/src/re_ranker.py
Prompts and state
- Graph state
V2_Py_project/src/state.py - Prompt templates
V2_Py_project/src/prompts.py
Knowledge sources
- Wikipedia document store
- Wiki search indexes
- Blog database
V2_Py_project/DB/LilianWeng_Three_blogs_DB.pkl
Other components
- Question input
- Final answer
Connections 29
- Question input → Single-question runner: provides question
V2_Py_project/main-singleQ.py - Single-question runner → Agent graph: builds and streams
V2_Py_project/main-singleQ.py - Agent graph → Plan and replan: starts at
V2_Py_project/src/graph.py - Agent graph → Query generation: routes to
V2_Py_project/src/graph.py - Agent graph → Retriever tool dispatch: routes to
V2_Py_project/src/graph.py - Agent graph → Subquestion answering: routes to
V2_Py_project/src/graph.py - Agent graph → Progress reflection: routes to
V2_Py_project/src/graph.py - Agent graph → Final synthesis: routes to
V2_Py_project/src/graph.py - Agent graph → Graph state: uses state
V2_Py_project/src/graph.py - Plan and replan → Query generation: sets plan
V2_Py_project/src/graph.py - Query generation → Retriever tool dispatch: requests retrieval
V2_Py_project/src/graph.py - Retriever tool dispatch → Subquestion answering: passes evidence
V2_Py_project/src/graph.py - Subquestion answering → Progress reflection: records answer
V2_Py_project/src/graph.py - Progress reflection → Query generation: continues
V2_Py_project/src/graph.py - Progress reflection → Plan and replan: replans
V2_Py_project/src/graph.py - Progress reflection → Final synthesis: ends at
V2_Py_project/src/graph.py - Final synthesis → Final answer: produces
- Plan and replan → Prompt templates: uses prompts
V2_Py_project/src/nodes.py - Query generation → Prompt templates: uses prompts
V2_Py_project/src/nodes.py - Subquestion answering → Prompt templates: uses prompts
V2_Py_project/src/nodes.py - Progress reflection → Prompt templates: uses prompts
V2_Py_project/src/nodes.py - Final synthesis → Prompt templates: uses prompts
V2_Py_project/src/nodes.py - Retriever tool dispatch → Hybrid wiki retriever: invokes tool
V2_Py_project/src/graph.py - Hybrid wiki retriever → Wikipedia document store: reads documents
V2_Py_project/src/retriever_of_wiki.py - Hybrid wiki retriever → Wiki search indexes: searches indexes
V2_Py_project/src/retriever_of_wiki.py - Subquestion answering → Document reranker: reranks candidates
V2_Py_project/src/nodes.py - Dense-only wiki retriever → Wikipedia document store: reads documents
V2_Py_project/src/retriever_of_wiki_dense_search_only.py - Dense-only wiki retriever → Wiki search indexes: searches index
V2_Py_project/src/retriever_of_wiki_dense_search_only.py - Blog dense retriever → Blog database: retrieves from
README.md