A local Python CLI research agent built with LangGraph, LangChain tools, OpenRouter, and Tavily.
- Runs an interactive chat loop in the terminal
- Uses a planner + tool-calling agent graph
- Searches the web and fetches specific pages
- Saves notes/reports to
output/ - Persists conversation checkpoints in SQLite by thread ID
- Windows PowerShell (or any shell)
- Python 3.10+
- API keys:
OPENROUTER_API_KEYTAVILY_API_KEY
cd "C:\Users\Emil P\Desktop\Web Dev\langraph_agent"
# Create and activate a fresh virtual environment
py -m venv .venv
.\.venv\Scripts\Activate.ps1
# Install dependencies
pip install -r requirements.txt
# Configure environment variables
Copy-Item .env.example .env
# Then edit .env and add your real API keys
# Run the agent
python .\main.pyIf python is not on PATH, use:
.\.venv\Scripts\python.exe .\main.py/help/verbose on/verbose off/threads/thread <id>/newthread/history [n]/save <filename>quit/exit/q
main.py: interactive CLI loop and user commandsagent.py: LangGraph state machine, planner/chatbot/tool routing, checkpointingtools.py: web/search/file tools used by the agentoutput/agent_checkpoints.db: SQLite checkpoint storage (auto-created)
save_to_fileasks for approval by default in interactive sessions.- Set
AUTO_APPROVE_FILE_WRITES=1in.envto skip save prompts. fetch_pagenow extracts readable text from HTML and returns source citations.