Ollama Deep Researcher is a fully local web research assistant that uses any LLM hosted by Ollama. Give it a topic, and it will generate a search query, gather web search results, summarize the results, reflect on the summary to examine knowledge gaps, generate a new search query to address the gaps, and improce the summary for a user-defined number of cycles. It will provide the user a final markdown summary with all sources used.
See it in action or build it yourself? Check out these helpful video tutorials:
- Overview of Ollama Deep Researcher with R1 - Load and test DeepSeek R1.
- Building Ollama Deep Researcher from Scratch - Overview of how this is built.
Pull a local LLM that you want to use from Ollama:
ollama pull llama3.2
ollama pull deepseek-r1:8b
For free web search (up to 1000 requests), you can use the Tavily API:
export TAVILY_API_KEY=<your_tavily_api_key>
Clone the repository and launch the assistant with the LangGraph server:
curl -LsSf https://astral.sh/uv/install.sh | sh
git clone https://github.com/langchain-ai/ollama-deep-researcher.git
cd ollama-deep-researcher
uvx --refresh --from "langgraph-cli[inmem]" --with-editable . --python 3.11 langgraph dev
You should see the following output and Studio will open in your browser:
Ready!
Docs: http://127.0.0.1:2024/docs
LangGraph Studio Web UI: https://smith.langchain.com/studio/?baseUrl=http://127.0.0.1:2024
Open LangGraph Studio Web UI
via the URL in the output above.
In the configuration
tab:
- You can set the name of your local LLM to use with Ollama (it will by default be
llama3.2
) - You can set the depth of the research iterations (it will by default be
3
)
![Screenshot 2025-01-24 at 10 08 31 PM](https://private-user-images.githubusercontent.com/122662504/406643027-7cfd0e04-28fd-4cfa-aee5-9a556d74ab21.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk2NjY4NTEsIm5iZiI6MTczOTY2NjU1MSwicGF0aCI6Ii8xMjI2NjI1MDQvNDA2NjQzMDI3LTdjZmQwZTA0LTI4ZmQtNGNmYS1hZWU1LTlhNTU2ZDc0YWIyMS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjE2JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIxNlQwMDQyMzFaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1hOTAzOTJjYzU2MDYyOTc0MDdkYzczZjJhY2MzZTJlMDc0Y2JmMGI3NzRhYjI4NTcxOGVmOGQ4ZTZkZGRkZTVlJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.mFV5tvzszG7F5GKF0Tr86_eUHY0AHcbDjK1uhz46aLM)
Give the assistant a topic for research, and you can visualize its process!
![Screenshot 2025-01-24 at 10 08 22 PM](https://private-user-images.githubusercontent.com/122662504/406643054-4de6bd89-4f3b-424c-a9cb-70ebd3d45c5f.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk2NjY4NTEsIm5iZiI6MTczOTY2NjU1MSwicGF0aCI6Ii8xMjI2NjI1MDQvNDA2NjQzMDU0LTRkZTZiZDg5LTRmM2ItNDI0Yy1hOWNiLTcwZWJkM2Q0NWM1Zi5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjE2JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIxNlQwMDQyMzFaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1iODE0MjIyNDE5OTM5YzQ5M2Q3NjkxOTVhN2IyMGYwOWZlODdhMmI3ZDk4NDlhNjcwY2ZlNzE4NTFiMzlhZWQ1JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.weWm409HY-9a2UgxNeKkjxkMTgnDJCXflzrH-vq8BlQ)
Ollama Deep Researcher is inspired by IterDRAG. This approach will decompose a query into sub-queries, retrieve documents for each one, answer the sub-query, and then build on the answer by retrieving docs for the second sub-query. Here, we do similar:
- Given a user-provided topic, use a local LLM (via Ollama) to generate a web search query
- Uses a search engine (configured for Tavily) to find relevant sources
- Uses LLM to summarize the findings from web search related to the user-provided research topic
- Then, it uses the LLM to reflect on the summary, identifying knowledge gaps
- It generates a new search query to address the knowledge gaps
- The process repeats, with the summary being iteratively updated with new information from web search
- It will repeat down the research rabbit hole
- Runs for a configurable number of iterations (see
configuration
tab)
The output of the graph is a markdown file containing the research summary, with citations to the sources used.
All sources gathered during research are saved to the graph state.
You can visualize them in the graph state, which is visible in LangGraph Studio:
The final summary is saved to the graph state as well:
There are various ways to deploy this graph.
See Module 6 of LangChain Academy for a detailed walkthrough of deployment options with LangGraph.