# dharanidharkola/deep-financial-research-agent architecture

> Architecture diagram of the GitHub repository dharanidharkola/deep-financial-research-agent, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/dharanidharkola/deep-financial-research-agent
- Repository: https://github.com/dharanidharkola/deep-financial-research-agent

## Overview

Financial Research Agent is a Streamlit financial-research product. A user submits a research query in the dashboard; the LangGraph workflow routes it by sector, plans and performs web research, gathers financial and annual-report context, analyzes findings, and generates a report. The graph preserves the documented research stages, supported sectors, report/export capabilities, and integrations. Some links rely on the README or SOURCE INDEX references because the corresponding source was not excerpted; those limits are reflected in the evidence paths.

Main entry points: [`backend/graph/workflow.py`](https://github.com/dharanidharkola/deep-financial-research-agent/blob/main/backend/graph/workflow.py) (LangGraph workflow), [`backend/llm.py`](https://github.com/dharanidharkola/deep-financial-research-agent/blob/main/backend/llm.py) (Language model), [`backend/agents/researcher_agent.py`](https://github.com/dharanidharkola/deep-financial-research-agent/blob/main/backend/agents/researcher_agent.py) (Web researcher), [`backend/agents/financial_agent.py`](https://github.com/dharanidharkola/deep-financial-research-agent/blob/main/backend/agents/financial_agent.py) (Financial collector)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Research dashboard"]
  node_dashboard["Research dashboard<br/>[1_Research.py]"]
  node_reports_ui["Reports browser<br/>[2_Reports.py]"]
  node_home["Dashboard home<br/>[app.py]"]
end

subgraph group_workflow["Research workflow"]
  node_workflow_graph["LangGraph workflow<br/>[workflow.py]"]
  node_state["Research state<br/>[state.py]"]
  node_router["Sector router<br/>[router_agent.py]"]
  node_planner["Research planner<br/>[planner_agent.py]"]
end

subgraph group_sources["Research sources"]
  node_researcher["Web researcher"]
  node_research_prompts["Research stages<br/>[research_prompt.py]"]
  node_stage_list["Stage definitions<br/>[research_stages.py]"]
  node_web_search["Web search tool<br/>[tavily_tool.py]"]
  node_financial["Financial collector<br/>[financial_agent.py]"]
  node_finance_tool["Finance data tool<br/>[finance_tool.py]"]
  node_company_compare["Company comparison<br/>[company_compare.py]"]
  node_it_agent["IT sector analysis<br/>[it_agent.py]"]
  node_pharma_agent["Pharma sector analysis<br/>[pharma_agent.py]"]
  node_ingest["Annual report ingestion<br/>[ingest.py]"]
  node_retriever["Document retrieval<br/>[retriever.py]"]
  node_vector_store[("Pinecone vector store<br/>[vector_store.py]")]
  node_rag_agent["Report context retrieval<br/>[rag_agent.py]"]
  node_metadata["Document metadata<br/>[metadata.py]"]
end

subgraph group_analysis["Analysis and reporting"]
  node_analyzer["Findings analyzer<br/>[analyzer_agent.py]"]
  node_reporter["Report generator<br/>[report_agent.py]"]
  node_report_manager["Report storage<br/>[report_manager.py]"]
  node_pdf_generator["PDF generator<br/>[pdf_generator.py]"]
  node_pdf_export["Markdown export<br/>[pdf_export.py]"]
end

subgraph group_shared["Shared services"]
  node_llm["Language model<br/>[llm.py]"]
  node_config["Service configuration<br/>[config.py]"]
end

node_user(("Research user"))
node_tavily{{"Tavily search"}}
node_yahoo{{"Yahoo Finance"}}
node_groq{{"Groq model service"}}
node_annual_reports["Annual report PDFs"]
node_pinecone[("Pinecone service")]

node_user -->|"submits query"| node_dashboard
node_dashboard -->|"invokes research"| node_workflow_graph
node_workflow_graph -->|"dispatches"| node_router
node_workflow_graph -->|"then dispatches"| node_planner
node_workflow_graph -->|"then dispatches"| node_researcher
node_workflow_graph -->|"then dispatches"| node_financial
node_workflow_graph -->|"then dispatches"| node_rag_agent
node_workflow_graph -->|"then dispatches"| node_analyzer
node_workflow_graph -->|"then dispatches"| node_reporter
node_workflow_graph -->|"uses state"| node_state
node_researcher -->|"searches web"| node_web_search
node_researcher -->|"formats queries"| node_research_prompts
node_researcher -->|"iterates stages"| node_stage_list
node_researcher -->|"generates next query"| node_llm
node_web_search -.->|"searches"| node_tavily
node_financial -->|"collects data"| node_finance_tool
node_financial -->|"uses sector analysis"| node_it_agent
node_financial -->|"uses sector analysis"| node_pharma_agent
node_finance_tool -.->|"gets finance data"| node_yahoo
node_ingest -->|"loads PDFs"| node_annual_reports
node_ingest -->|"uploads chunks"| node_vector_store
node_vector_store -.->|"stores vectors"| node_pinecone
node_rag_agent -->|"retrieves context"| node_retriever
node_retriever -->|"searches vectors"| node_vector_store
node_analyzer -->|"analyzes findings"| node_llm
node_planner -->|"creates plan"| node_llm
node_reporter -->|"generates report"| node_llm
node_reporter -->|"saves report"| node_report_manager
node_report_manager -->|"creates PDF"| node_pdf_generator
node_reports_ui -.->|"browses reports"| node_report_manager
node_dashboard -.->|"exports markdown"| node_pdf_export
node_llm -->|"loads credentials"| node_config
node_llm -->|"invokes model"| node_groq
node_web_search -->|"loads credentials"| node_config
node_vector_store -->|"loads credentials"| node_config

click node_dashboard "https://github.com/dharanidharkola/deep-financial-research-agent/blob/main/frontend/pages/1_Research.py"
click node_reports_ui "https://github.com/dharanidharkola/deep-financial-research-agent/blob/main/frontend/pages/2_Reports.py"
click node_home "https://github.com/dharanidharkola/deep-financial-research-agent/blob/main/frontend/app.py"
click node_workflow_graph "https://github.com/dharanidharkola/deep-financial-research-agent/blob/main/backend/graph/workflow.py"
click node_state "https://github.com/dharanidharkola/deep-financial-research-agent/blob/main/backend/models/state.py"
click node_router "https://github.com/dharanidharkola/deep-financial-research-agent/blob/main/backend/agents/router_agent.py"
click node_planner "https://github.com/dharanidharkola/deep-financial-research-agent/blob/main/backend/agents/planner_agent.py"
click node_researcher "https://github.com/dharanidharkola/deep-financial-research-agent/blob/main/backend/agents/researcher_agent.py"
click node_research_prompts "https://github.com/dharanidharkola/deep-financial-research-agent/blob/main/backend/prompts/research_prompt.py"
click node_stage_list "https://github.com/dharanidharkola/deep-financial-research-agent/blob/main/backend/prompts/research_stages.py"
click node_web_search "https://github.com/dharanidharkola/deep-financial-research-agent/blob/main/backend/tools/tavily_tool.py"
click node_financial "https://github.com/dharanidharkola/deep-financial-research-agent/blob/main/backend/agents/financial_agent.py"
click node_finance_tool "https://github.com/dharanidharkola/deep-financial-research-agent/blob/main/backend/tools/finance_tool.py"
click node_company_compare "https://github.com/dharanidharkola/deep-financial-research-agent/blob/main/backend/tools/company_compare.py"
click node_it_agent "https://github.com/dharanidharkola/deep-financial-research-agent/blob/main/backend/sector_agents/it_agent.py"
click node_pharma_agent "https://github.com/dharanidharkola/deep-financial-research-agent/blob/main/backend/sector_agents/pharma_agent.py"
click node_ingest "https://github.com/dharanidharkola/deep-financial-research-agent/blob/main/backend/rag/ingest.py"
click node_retriever "https://github.com/dharanidharkola/deep-financial-research-agent/blob/main/backend/rag/retriever.py"
click node_vector_store "https://github.com/dharanidharkola/deep-financial-research-agent/blob/main/backend/rag/vector_store.py"
click node_rag_agent "https://github.com/dharanidharkola/deep-financial-research-agent/blob/main/backend/agents/rag_agent.py"
click node_metadata "https://github.com/dharanidharkola/deep-financial-research-agent/blob/main/backend/rag/metadata.py"
click node_analyzer "https://github.com/dharanidharkola/deep-financial-research-agent/blob/main/backend/agents/analyzer_agent.py"
click node_reporter "https://github.com/dharanidharkola/deep-financial-research-agent/blob/main/backend/agents/report_agent.py"
click node_report_manager "https://github.com/dharanidharkola/deep-financial-research-agent/blob/main/backend/utils/report_manager.py"
click node_pdf_generator "https://github.com/dharanidharkola/deep-financial-research-agent/blob/main/backend/utils/pdf_generator.py"
click node_pdf_export "https://github.com/dharanidharkola/deep-financial-research-agent/blob/main/backend/utils/pdf_export.py"
click node_llm "https://github.com/dharanidharkola/deep-financial-research-agent/blob/main/backend/llm.py"
click node_config "https://github.com/dharanidharkola/deep-financial-research-agent/blob/main/backend/config.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_dashboard,node_reports_ui,node_home,node_user toneBlue
class node_workflow_graph,node_state,node_router,node_planner,node_pinecone toneAmber
class node_researcher,node_research_prompts,node_stage_list,node_web_search,node_financial,node_finance_tool,node_company_compare,node_it_agent,node_pharma_agent,node_ingest,node_retriever,node_vector_store,node_rag_agent,node_metadata toneMint
class node_analyzer,node_reporter,node_report_manager,node_pdf_generator,node_pdf_export toneRose
class node_llm,node_config,node_tavily,node_yahoo,node_groq,node_annual_reports toneIndigo
```

## Components

### Research dashboard

- [Research dashboard](https://github.com/dharanidharkola/deep-financial-research-agent/blob/main/frontend/pages/1_Research.py): `frontend/pages/1_Research.py`
- [Reports browser](https://github.com/dharanidharkola/deep-financial-research-agent/blob/main/frontend/pages/2_Reports.py): `frontend/pages/2_Reports.py`
- [Dashboard home](https://github.com/dharanidharkola/deep-financial-research-agent/blob/main/frontend/app.py): `frontend/app.py`

### Research workflow

- [LangGraph workflow](https://github.com/dharanidharkola/deep-financial-research-agent/blob/main/backend/graph/workflow.py): `backend/graph/workflow.py`
- [Research state](https://github.com/dharanidharkola/deep-financial-research-agent/blob/main/backend/models/state.py): `backend/models/state.py`
- [Sector router](https://github.com/dharanidharkola/deep-financial-research-agent/blob/main/backend/agents/router_agent.py): `backend/agents/router_agent.py`
- [Research planner](https://github.com/dharanidharkola/deep-financial-research-agent/blob/main/backend/agents/planner_agent.py): `backend/agents/planner_agent.py`

### Research sources

- [Web researcher](https://github.com/dharanidharkola/deep-financial-research-agent/blob/main/backend/agents/researcher_agent.py): `backend/agents/researcher_agent.py`
- [Research stages](https://github.com/dharanidharkola/deep-financial-research-agent/blob/main/backend/prompts/research_prompt.py): `backend/prompts/research_prompt.py`
- [Stage definitions](https://github.com/dharanidharkola/deep-financial-research-agent/blob/main/backend/prompts/research_stages.py): `backend/prompts/research_stages.py`
- [Web search tool](https://github.com/dharanidharkola/deep-financial-research-agent/blob/main/backend/tools/tavily_tool.py): `backend/tools/tavily_tool.py`
- [Financial collector](https://github.com/dharanidharkola/deep-financial-research-agent/blob/main/backend/agents/financial_agent.py): `backend/agents/financial_agent.py`
- [Finance data tool](https://github.com/dharanidharkola/deep-financial-research-agent/blob/main/backend/tools/finance_tool.py): `backend/tools/finance_tool.py`
- [Company comparison](https://github.com/dharanidharkola/deep-financial-research-agent/blob/main/backend/tools/company_compare.py): `backend/tools/company_compare.py`
- [IT sector analysis](https://github.com/dharanidharkola/deep-financial-research-agent/blob/main/backend/sector_agents/it_agent.py): `backend/sector_agents/it_agent.py`
- [Pharma sector analysis](https://github.com/dharanidharkola/deep-financial-research-agent/blob/main/backend/sector_agents/pharma_agent.py): `backend/sector_agents/pharma_agent.py`
- [Annual report ingestion](https://github.com/dharanidharkola/deep-financial-research-agent/blob/main/backend/rag/ingest.py): `backend/rag/ingest.py`
- [Document retrieval](https://github.com/dharanidharkola/deep-financial-research-agent/blob/main/backend/rag/retriever.py): `backend/rag/retriever.py`
- [Pinecone vector store](https://github.com/dharanidharkola/deep-financial-research-agent/blob/main/backend/rag/vector_store.py): `backend/rag/vector_store.py`
- [Report context retrieval](https://github.com/dharanidharkola/deep-financial-research-agent/blob/main/backend/agents/rag_agent.py): `backend/agents/rag_agent.py`
- [Document metadata](https://github.com/dharanidharkola/deep-financial-research-agent/blob/main/backend/rag/metadata.py): `backend/rag/metadata.py`

### Analysis and reporting

- [Findings analyzer](https://github.com/dharanidharkola/deep-financial-research-agent/blob/main/backend/agents/analyzer_agent.py): `backend/agents/analyzer_agent.py`
- [Report generator](https://github.com/dharanidharkola/deep-financial-research-agent/blob/main/backend/agents/report_agent.py): `backend/agents/report_agent.py`
- [Report storage](https://github.com/dharanidharkola/deep-financial-research-agent/blob/main/backend/utils/report_manager.py): `backend/utils/report_manager.py`
- [PDF generator](https://github.com/dharanidharkola/deep-financial-research-agent/blob/main/backend/utils/pdf_generator.py): `backend/utils/pdf_generator.py`
- [Markdown export](https://github.com/dharanidharkola/deep-financial-research-agent/blob/main/backend/utils/pdf_export.py): `backend/utils/pdf_export.py`

### Shared services

- [Language model](https://github.com/dharanidharkola/deep-financial-research-agent/blob/main/backend/llm.py): `backend/llm.py`
- [Service configuration](https://github.com/dharanidharkola/deep-financial-research-agent/blob/main/backend/config.py): `backend/config.py`

### Other components

- **Research user**
- **Tavily search**
- **Yahoo Finance**
- **Groq model service**
- **Annual report PDFs**
- **Pinecone service**

## Connections

- Research user → Research dashboard: submits query (evidence: `frontend/pages/1_Research.py`)
- Research dashboard → LangGraph workflow: invokes research (evidence: `frontend/pages/1_Research.py`)
- LangGraph workflow → Sector router: dispatches (evidence: `backend/graph/workflow.py`)
- LangGraph workflow → Research planner: then dispatches (evidence: `backend/graph/workflow.py`)
- LangGraph workflow → Web researcher: then dispatches (evidence: `backend/graph/workflow.py`)
- LangGraph workflow → Financial collector: then dispatches (evidence: `backend/graph/workflow.py`)
- LangGraph workflow → Report context retrieval: then dispatches (evidence: `backend/graph/workflow.py`)
- LangGraph workflow → Findings analyzer: then dispatches (evidence: `backend/graph/workflow.py`)
- LangGraph workflow → Report generator: then dispatches (evidence: `backend/graph/workflow.py`)
- LangGraph workflow → Research state: uses state (evidence: `backend/graph/workflow.py`)
- Web researcher → Web search tool: searches web (evidence: `backend/agents/researcher_agent.py`)
- Web researcher → Research stages: formats queries (evidence: `backend/agents/researcher_agent.py`)
- Web researcher → Stage definitions: iterates stages (evidence: `backend/agents/researcher_agent.py`)
- Web researcher → Language model: generates next query (evidence: `backend/agents/researcher_agent.py`)
- Web search tool → Tavily search: searches (evidence: `README.md`)
- Financial collector → Finance data tool: collects data (evidence: `backend/agents/financial_agent.py`)
- Financial collector → IT sector analysis: uses sector analysis (evidence: `backend/agents/financial_agent.py`)
- Financial collector → Pharma sector analysis: uses sector analysis (evidence: `backend/agents/financial_agent.py`)
- Finance data tool → Yahoo Finance: gets finance data (evidence: `README.md`)
- Annual report ingestion → Annual report PDFs: loads PDFs (evidence: `backend/rag/ingest.py`)
- Annual report ingestion → Pinecone vector store: uploads chunks (evidence: `backend/rag/ingest.py`)
- Pinecone vector store → Pinecone service: stores vectors (evidence: `README.md`)
- Report context retrieval → Document retrieval: retrieves context (evidence: `backend/agents/rag_agent.py`)
- Document retrieval → Pinecone vector store: searches vectors (evidence: `backend/rag/retriever.py`)
- Findings analyzer → Language model: analyzes findings (evidence: `backend/agents/analyzer_agent.py`)
- Research planner → Language model: creates plan (evidence: `backend/agents/planner_agent.py`)
- Report generator → Language model: generates report (evidence: `backend/agents/report_agent.py`)
- Report generator → Report storage: saves report (evidence: `backend/agents/report_agent.py`)
- Report storage → PDF generator: creates PDF (evidence: `backend/utils/report_manager.py`)
- Reports browser → Report storage: browses reports
- Research dashboard → Markdown export: exports markdown (evidence: `README.md`)
- Language model → Service configuration: loads credentials (evidence: `backend/llm.py`)
- Language model → Groq model service: invokes model (evidence: `backend/llm.py`)
- Web search tool → Service configuration: loads credentials (evidence: `backend/tools/tavily_tool.py`)
- Pinecone vector store → Service configuration: loads credentials (evidence: `backend/rag/vector_store.py`)
