How ai-doneus/deep-research-agent works
Deep-Research-Agent is a LangGraph research assistant: it accepts a query, scopes it into a brief, researches that brief with web tools, reduces findings, and writes a report. Context management (prompt caching, retrieval, offloading, reduction, and isolation) is a supporting layer. The graph, node, and helper connections shown are supported by the excerpts; some indexed modules, including model, configuration, isolation, and routing, were not excerpted, so their runtime wiring is not assumed.
Main entry points: research.py Research agent · main.py CLI entry · graph.py Workflow graph · scope.py Scope brief
Components 20
Research workflow
- CLI entry
src/main.py - Workflow graph
src/agent/graph.py - Scope brief
src/agent/nodes/scope.py - Research agent
src/agent/nodes/research.py - Report writer
src/agent/nodes/write.py - Tool router
src/agent/router.py
Context engineering
- Prompt caching
src/ctx/cache.py - Tool retrieval
src/ctx/retrieve.py - Note offload
src/ctx/offload.py - Note reduction
src/ctx/reduce.py - Context isolation
src/ctx/isolate.py
Models and tools
- Web search tool
src/tools/web_search.py - Tavily search
- Model wrapper
src/model/base_model.py - Anthropic API
Runtime state
- Agent state
src/agent/state.py - Research notes
memory - Configuration
src/config/configurations.py
Other components
- Research user
- Final report
Connections 19
- Research user → CLI entry: submits query
src/main.py - CLI entry → Configuration: checks environment
src/main.py - CLI entry → Workflow graph: invokes graph
src/main.py - Workflow graph → Scope brief: runs first
src/agent/graph.py - Workflow graph → Research agent: runs next
src/agent/graph.py - Workflow graph → Report writer: runs last
src/agent/graph.py - Scope brief → Prompt caching: builds cached prompt
src/agent/nodes/scope.py - Scope brief → Anthropic API: requests brief
src/agent/nodes/scope.py - Research agent → Tool retrieval: selects tools
src/agent/nodes/research.py - Research agent → Prompt caching: builds cached prompt
src/agent/nodes/research.py - Research agent → Web search tool: invokes selected tool
src/agent/nodes/research.py - Web search tool → Tavily search: searches web
src/tools/web_search.py - Research agent → Note offload: saves tool results
src/agent/nodes/research.py - Note offload → Research notes: writes notes
src/ctx/offload.py - Research agent → Note reduction: summarizes notes
src/agent/nodes/research.py - Research agent → Anthropic API: requests research
src/agent/nodes/research.py - Report writer → Prompt caching: builds cached prompt
src/agent/nodes/write.py - Report writer → Anthropic API: requests report
src/agent/nodes/write.py - CLI entry → Final report: prints result
src/main.py