An local search and research agent built in Python. This project lets a local LLM run multi-step web searches, re-rank search results, maintain long-term memory across sessions, and audit its own responses against retrieved source text to avoid hallucinations.
I built this project to experiment with local agentic workflows without depending on closed API ecosystems or paid search services. Everything runs locally on top of Ollama.
- Planning: Given a prompt, the agent breaks down the problem into sub-queries and execution steps
- Search & Scraping: It queries DuckDuckGo, Jina, Tavily, Google CSE, or Bing depending on what keys are configured, falling back automatically if a provider fails.
- Re-Ranking: Results are re-ranked using FastEmbed to make sure the context window gets the most relevant snippets.
- Memory: ChromaDB stores past search chunks and answered prompts so the agent can recall context from prior searches.
- Grounding Audit: The agent evaluates its response against the retrieved source texts. If claims are unsupported or context is missing, it should refrain from guessing and issues a refusal.
- Plan and Execute Framework: Generates structured step-by-step search plans before synthesis
- Persistent Vector Memory: Uses ChromaDB for storing and retrieving prior research context
- Multi-Provider Web Search: Supports DuckDuckGo, Jina Search, Tavily, Google Custom Search and Bing Search
- Cross-Encoder Re-Ranking: Filters noise out of web search results before passing them into the model's context window
- Anti-Hallucination Guardrails: Audits output sentences against retrieved text and adds citations
- AST Math Sandbox: Evaluates math expressions safely without using raw
eval()
Python 3.10 or higher
Ollama installed and running locally
- Install Dependencies
Clone the repository and install the Python requirements:
pip install -r requirement.txt
- Pull Required Models
Make sure the Ollama daemon is running, then pull the target LLM and embedding model:
ollama serve
ollama pull qwen3:8b
ollama pull qwen3-embedding:0.6b
- Run a Search Query
Run a single search query directly from your command line:
python -m agentic_search.cli "your_prompt"
- Interactive Mode
Start an interactive shell session:
python -m agentic_search.cli --interactive