How shahzaibkaramat67-coder/langchain_tool_agent works
This is a command-line research assistant. A user submits a question; the agent decides whether to use search, webpage reading, or calculation, then a formatter model turns the agent’s result into a structured answer. Search results are followed by webpage extraction. The model factory configures the OpenRouter-backed chat model. Edges reflect the calls and tool registration visible in agent.py and the tool implementations; external services are shown only where the code supports them.
Main entry points: agent.py Question agent · research_tool.py Web search tool · web_reader.py Webpage reader · model.py Chat model client
Components 11
Question workflow
- Question agent
agent.py - Answer formatter
agent.py
Research tools
- Web search tool
research_tool.py - Webpage reader
web_reader.py - Calculator
calculator.py
Model integration
- Model factory
model.py - Chat model client
model.py
Other components
- User
- OpenRouter API
- DuckDuckGo search
- Websites
Connections 13
- User → Question agent: submits question
agent.py - Question agent → User: prints answer
agent.py - Question agent → Model factory: creates clients
agent.py - Model factory → Chat model client: configures
model.py - Chat model client → OpenRouter API: calls API
model.py - Question agent → Answer formatter: formats result
agent.py - Answer formatter → Chat model client: streams completion
agent.py - Question agent → Web search tool: registers tool
agent.py - Question agent → Webpage reader: registers tool
agent.py - Question agent → Calculator: registers tool
agent.py - Web search tool → DuckDuckGo search: searches query
research_tool.py - Web search tool → Webpage reader: reads result pages
research_tool.py - Webpage reader → Websites: fetches page
web_reader.py