# sagartrimukhe/ai-investment-research-assistant architecture

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

- Interactive diagram: https://gitdiagram.com/sagartrimukhe/ai-investment-research-assistant
- Repository: https://github.com/sagartrimukhe/ai-investment-research-assistant

## Overview

This is a Streamlit equity-research assistant: analysts upload or select filings, index them, run a ticker research workflow, and review a synthesized thesis before sign-off. The workflow routes inputs to filing-based fundamentals and trend analysis, then performs peer comparison, thesis synthesis, and a human approval gate. Separate UI capabilities show market data and export reports. Edges follow excerpts, SOURCE INDEX references, or README statements; several agent internals and export details were not sampled, so their links are limited to documented or indexed wiring.

Main entry points: [`app/services/workflow_service.py`](https://github.com/sagartrimukhe/ai-investment-research-assistant/blob/main/app/services/workflow_service.py) (Workflow orchestration), [`app/main.py`](https://github.com/sagartrimukhe/ai-investment-research-assistant/blob/main/app/main.py) (Streamlit research UI), [`app/services/document_ingestion.py`](https://github.com/sagartrimukhe/ai-investment-research-assistant/blob/main/app/services/document_ingestion.py) (Document ingestion), [`app/agents/market_research.py`](https://github.com/sagartrimukhe/ai-investment-research-assistant/blob/main/app/agents/market_research.py) (Fundamental research)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Analyst interface"]
  node_app["Streamlit research UI<br/>[main.py]"]
end

subgraph group_documents["Filing ingestion"]
  node_ingest["Document ingestion"]
  node_splitter["Text splitting<br/>[text_splitter.py]"]
  node_nasdaq["NASDAQ universe<br/>[nasdaq_universe.py]"]
end

subgraph group_workflow["Research workflow"]
  node_workflow["Workflow orchestration"]
  node_state["Shared agent state<br/>[state.py]"]
  node_router["Input router<br/>[router.py]"]
  node_marketresearch["Fundamental research<br/>[market_research.py]"]
  node_trend["Trend analysis<br/>[trend_analysis.py]"]
  node_comparison["Peer comparison"]
  node_summary["Thesis synthesis<br/>[summary_agent.py]"]
  node_hitl["Analyst approval gate<br/>[hitl.py]"]
end

subgraph group_services["Research services"]
  node_financialtools["Financial research tools<br/>[financial_tools.py]"]
  node_retrieval["Filing retrieval"]
  node_export["Report export<br/>[export_service.py]"]
end

subgraph group_integrations["Data integrations"]
  node_llm{{"Gemini language model"}}
  node_vector[("Filing vector store<br/>[vector_store.py]")]
  node_marketdata["Market data<br/>[market_data.py]"]
  node_s3[("S3 archive<br/>[s3_client.py]")]
end

node_analyst(("Analyst"))
node_yfinance{{"yfinance"}}

node_analyst -->|"uses"| node_app
node_app -->|"indexes filings"| node_ingest
node_ingest -->|"splits text"| node_splitter
node_ingest -->|"writes chunks"| node_vector
node_ingest -->|"detects ticker"| node_nasdaq
node_app -->|"runs research"| node_workflow
node_workflow -->|"uses state"| node_state
node_workflow -->|"dispatches"| node_router
node_workflow -->|"dispatches"| node_marketresearch
node_workflow -->|"dispatches"| node_trend
node_workflow -->|"dispatches"| node_comparison
node_workflow -->|"dispatches"| node_summary
node_workflow -->|"dispatches"| node_hitl
node_workflow -->|"routes"| node_marketresearch
node_workflow -->|"routes"| node_trend
node_workflow -->|"routes"| node_comparison
node_workflow -->|"routes"| node_summary
node_workflow -->|"routes"| node_hitl
node_marketresearch -->|"searches filings"| node_vector
node_marketresearch -->|"extracts metrics"| node_llm
node_comparison -->|"uses tools"| node_financialtools
node_financialtools -->|"fetches metrics"| node_marketdata
node_financialtools -->|"searches filings"| node_vector
node_marketdata -->|"fetches prices"| node_yfinance
node_app -->|"shows prices"| node_marketdata
node_app -.->|"archives uploads"| node_s3
node_app -->|"exports reports"| node_export
node_retrieval -->|"searches chunks"| node_vector
node_analyst -->|"reviews thesis"| node_app

click node_app "https://github.com/sagartrimukhe/ai-investment-research-assistant/blob/main/app/main.py"
click node_ingest "https://github.com/sagartrimukhe/ai-investment-research-assistant/blob/main/app/services/document_ingestion.py"
click node_splitter "https://github.com/sagartrimukhe/ai-investment-research-assistant/blob/main/app/utils/text_splitter.py"
click node_nasdaq "https://github.com/sagartrimukhe/ai-investment-research-assistant/blob/main/app/services/nasdaq_universe.py"
click node_workflow "https://github.com/sagartrimukhe/ai-investment-research-assistant/blob/main/app/services/workflow_service.py"
click node_state "https://github.com/sagartrimukhe/ai-investment-research-assistant/blob/main/app/core/state.py"
click node_router "https://github.com/sagartrimukhe/ai-investment-research-assistant/blob/main/app/agents/router.py"
click node_marketresearch "https://github.com/sagartrimukhe/ai-investment-research-assistant/blob/main/app/agents/market_research.py"
click node_trend "https://github.com/sagartrimukhe/ai-investment-research-assistant/blob/main/app/agents/trend_analysis.py"
click node_comparison "https://github.com/sagartrimukhe/ai-investment-research-assistant/blob/main/app/agents/comparative_analysis.py"
click node_summary "https://github.com/sagartrimukhe/ai-investment-research-assistant/blob/main/app/agents/summary_agent.py"
click node_hitl "https://github.com/sagartrimukhe/ai-investment-research-assistant/blob/main/app/agents/hitl.py"
click node_financialtools "https://github.com/sagartrimukhe/ai-investment-research-assistant/blob/main/app/tools/financial_tools.py"
click node_retrieval "https://github.com/sagartrimukhe/ai-investment-research-assistant/blob/main/app/services/retrieval_service.py"
click node_vector "https://github.com/sagartrimukhe/ai-investment-research-assistant/blob/main/app/integrations/vector_store.py"
click node_marketdata "https://github.com/sagartrimukhe/ai-investment-research-assistant/blob/main/app/integrations/market_data.py"
click node_s3 "https://github.com/sagartrimukhe/ai-investment-research-assistant/blob/main/app/integrations/s3_client.py"
click node_export "https://github.com/sagartrimukhe/ai-investment-research-assistant/blob/main/app/services/export_service.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_app toneBlue
class node_ingest,node_splitter,node_nasdaq toneAmber
class node_workflow,node_state,node_router,node_marketresearch,node_trend,node_comparison,node_summary,node_hitl toneMint
class node_financialtools,node_retrieval,node_export toneRose
class node_llm,node_vector,node_marketdata,node_s3,node_analyst,node_yfinance toneIndigo
```

## Components

### Analyst interface

- [Streamlit research UI](https://github.com/sagartrimukhe/ai-investment-research-assistant/blob/main/app/main.py): `app/main.py`

### Filing ingestion

- [Document ingestion](https://github.com/sagartrimukhe/ai-investment-research-assistant/blob/main/app/services/document_ingestion.py): `app/services/document_ingestion.py`
- [Text splitting](https://github.com/sagartrimukhe/ai-investment-research-assistant/blob/main/app/utils/text_splitter.py): `app/utils/text_splitter.py`
- [NASDAQ universe](https://github.com/sagartrimukhe/ai-investment-research-assistant/blob/main/app/services/nasdaq_universe.py): `app/services/nasdaq_universe.py`

### Research workflow

- [Workflow orchestration](https://github.com/sagartrimukhe/ai-investment-research-assistant/blob/main/app/services/workflow_service.py): `app/services/workflow_service.py`
- [Shared agent state](https://github.com/sagartrimukhe/ai-investment-research-assistant/blob/main/app/core/state.py): `app/core/state.py`
- [Input router](https://github.com/sagartrimukhe/ai-investment-research-assistant/blob/main/app/agents/router.py): `app/agents/router.py`
- [Fundamental research](https://github.com/sagartrimukhe/ai-investment-research-assistant/blob/main/app/agents/market_research.py): `app/agents/market_research.py`
- [Trend analysis](https://github.com/sagartrimukhe/ai-investment-research-assistant/blob/main/app/agents/trend_analysis.py): `app/agents/trend_analysis.py`
- [Peer comparison](https://github.com/sagartrimukhe/ai-investment-research-assistant/blob/main/app/agents/comparative_analysis.py): `app/agents/comparative_analysis.py`
- [Thesis synthesis](https://github.com/sagartrimukhe/ai-investment-research-assistant/blob/main/app/agents/summary_agent.py): `app/agents/summary_agent.py`
- [Analyst approval gate](https://github.com/sagartrimukhe/ai-investment-research-assistant/blob/main/app/agents/hitl.py): `app/agents/hitl.py`

### Research services

- [Financial research tools](https://github.com/sagartrimukhe/ai-investment-research-assistant/blob/main/app/tools/financial_tools.py): `app/tools/financial_tools.py`
- [Filing retrieval](https://github.com/sagartrimukhe/ai-investment-research-assistant/blob/main/app/services/retrieval_service.py): `app/services/retrieval_service.py`
- [Report export](https://github.com/sagartrimukhe/ai-investment-research-assistant/blob/main/app/services/export_service.py): `app/services/export_service.py`

### Data integrations

- **Gemini language model**
- [Filing vector store](https://github.com/sagartrimukhe/ai-investment-research-assistant/blob/main/app/integrations/vector_store.py): `app/integrations/vector_store.py`
- [Market data](https://github.com/sagartrimukhe/ai-investment-research-assistant/blob/main/app/integrations/market_data.py): `app/integrations/market_data.py`
- [S3 archive](https://github.com/sagartrimukhe/ai-investment-research-assistant/blob/main/app/integrations/s3_client.py): `app/integrations/s3_client.py`

### Other components

- **Analyst**
- **yfinance**

## Connections

- Analyst → Streamlit research UI: uses (evidence: `README.md`)
- Streamlit research UI → Document ingestion: indexes filings (evidence: `app/main.py`)
- Document ingestion → Text splitting: splits text (evidence: `app/services/document_ingestion.py`)
- Document ingestion → Filing vector store: writes chunks (evidence: `app/services/document_ingestion.py`)
- Document ingestion → NASDAQ universe: detects ticker (evidence: `app/services/document_ingestion.py`)
- Streamlit research UI → Workflow orchestration: runs research (evidence: `app/main.py`)
- Workflow orchestration → Shared agent state: uses state (evidence: `app/services/workflow_service.py`)
- Workflow orchestration → Input router: dispatches (evidence: `app/services/workflow_service.py`)
- Workflow orchestration → Fundamental research: dispatches (evidence: `app/services/workflow_service.py`)
- Workflow orchestration → Trend analysis: dispatches (evidence: `app/services/workflow_service.py`)
- Workflow orchestration → Peer comparison: dispatches (evidence: `app/services/workflow_service.py`)
- Workflow orchestration → Thesis synthesis: dispatches (evidence: `app/services/workflow_service.py`)
- Workflow orchestration → Analyst approval gate: dispatches (evidence: `app/services/workflow_service.py`)
- Workflow orchestration → Fundamental research: routes (evidence: `app/services/workflow_service.py`)
- Workflow orchestration → Trend analysis: routes (evidence: `app/services/workflow_service.py`)
- Workflow orchestration → Peer comparison: routes (evidence: `app/services/workflow_service.py`)
- Workflow orchestration → Thesis synthesis: routes (evidence: `app/services/workflow_service.py`)
- Workflow orchestration → Analyst approval gate: routes (evidence: `app/services/workflow_service.py`)
- Fundamental research → Filing vector store: searches filings (evidence: `app/agents/market_research.py`)
- Fundamental research → Gemini language model: extracts metrics (evidence: `app/agents/market_research.py`)
- Peer comparison → Financial research tools: uses tools (evidence: `app/agents/comparative_analysis.py`)
- Financial research tools → Market data: fetches metrics (evidence: `app/tools/financial_tools.py`)
- Financial research tools → Filing vector store: searches filings (evidence: `app/tools/financial_tools.py`)
- Market data → yfinance: fetches prices (evidence: `app/integrations/market_data.py`)
- Streamlit research UI → Market data: shows prices (evidence: `app/main.py`)
- Streamlit research UI → S3 archive: archives uploads (evidence: `app/main.py`)
- Streamlit research UI → Report export: exports reports (evidence: `app/main.py`)
- Filing retrieval → Filing vector store: searches chunks (evidence: `app/services/retrieval_service.py`)
- Analyst → Streamlit research UI: reviews thesis (evidence: `README.md`)
