# rabilkhan786/financial-agent-crew architecture

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

- Interactive diagram: https://gitdiagram.com/rabilkhan786/financial-agent-crew
- Repository: https://github.com/rabilkhan786/financial-agent-crew

## Overview

This is a multi-agent financial research app: a user submits a ticker and date range through Streamlit and FastAPI, then a LangGraph workflow validates the ticker, gathers market context and fundamentals, analyzes price performance, writes and reviews a report, and returns report artifacts. Python computes the financial metrics; the LLM explains and reviews them. The README documents the product-level flow and capabilities; some UI, API, report, and agent relationships are supported by the source index rather than inspected implementation excerpts.

Main entry points: [`src/core/graph.py`](https://github.com/rabilkhan786/financial-agent-crew/blob/main/src/core/graph.py) (LangGraph workflow), [`src/core/llm.py`](https://github.com/rabilkhan786/financial-agent-crew/blob/main/src/core/llm.py) (LLM client), [`src/agents/fundamentals_analyst.py`](https://github.com/rabilkhan786/financial-agent-crew/blob/main/src/agents/fundamentals_analyst.py) (Fundamentals analyst), [`src/agents/data_analyst.py`](https://github.com/rabilkhan786/financial-agent-crew/blob/main/src/agents/data_analyst.py) (Data analyst)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interfaces["User interfaces"]
  node_streamlit["Streamlit UI<br/>[app.py]"]
  node_api["FastAPI<br/>[api.py]"]
end

subgraph group_workflow["Agent workflow"]
  node_graph["LangGraph workflow<br/>[graph.py]"]
  node_orchestrator["Orchestrator<br/>[orchestrator.py]"]
end

subgraph group_analysis["Research and analysis"]
  node_market_research["Market researcher"]
  node_fundamentals["Fundamentals analyst"]
  node_data_analyst["Data analyst<br/>[data_analyst.py]"]
  node_market_data["Market data<br/>[market_data.py]"]
  node_statements["Financial statements<br/>[statements.py]"]
  node_ratios["Fundamental metrics<br/>[ratios.py]"]
  node_kpi["Price KPIs<br/>[kpi.py]"]
  node_news["News retrieval<br/>[news.py]"]
  node_social["Social sentiment<br/>[social.py]"]
end

subgraph group_output["Report and shared services"]
  node_report_writer["Report writer<br/>[report_writer.py]"]
  node_charts["Chart generation<br/>[charts.py]"]
  node_formatting["Metric formatting<br/>[formatting.py]"]
  node_serialization["State serialization<br/>[serialization.py]"]
  node_pdf["PDF reporting<br/>[report_pdf.py]"]
  node_llm["LLM client<br/>[llm.py]"]
  node_config["Configuration<br/>[config.py]"]
end

node_user(("User"))
node_yahoo["Yahoo Finance"]
node_stocktwits["StockTwits"]
node_groq["Groq model"]

node_user -->|"enters ticker and dates"| node_streamlit
node_streamlit -->|"submits analysis"| node_api
node_api -->|"runs workflow"| node_graph
node_graph -->|"starts intake"| node_orchestrator
node_orchestrator -->|"fetches profile"| node_market_data
node_graph -->|"dispatches"| node_market_research
node_market_research -->|"fetches headlines"| node_news
node_market_research -->|"fetches posts"| node_social
node_market_research -->|"summarizes context"| node_llm
node_graph -->|"dispatches"| node_fundamentals
node_fundamentals -->|"fetches statements"| node_statements
node_fundamentals -->|"fetches price history"| node_market_data
node_fundamentals -->|"calculates metrics"| node_ratios
node_fundamentals -->|"formats findings"| node_formatting
node_fundamentals -->|"explains results"| node_llm
node_graph -->|"dispatches"| node_data_analyst
node_data_analyst -->|"fetches prices"| node_market_data
node_data_analyst -->|"calculates performance"| node_kpi
node_data_analyst -->|"builds charts"| node_charts
node_data_analyst -->|"explains metrics"| node_llm
node_graph -->|"dispatches"| node_report_writer
node_report_writer -->|"formats findings"| node_formatting
node_report_writer -->|"writes report"| node_llm
node_graph -->|"routes review"| node_orchestrator
node_orchestrator -->|"reviews report"| node_llm
node_market_data -->|"requests market data"| node_yahoo
node_news -.->|"fetches company news"| node_yahoo
node_social -.->|"fetches sentiment posts"| node_stocktwits
node_llm -->|"invokes model"| node_groq
node_api -->|"creates PDF"| node_pdf
node_api -->|"serializes response"| node_serialization
node_streamlit -->|"uses report data"| node_serialization
node_streamlit -->|"formats display"| node_formatting
node_charts -->|"uses metric threshold"| node_ratios
node_llm -->|"loads model settings"| node_config

click node_streamlit "https://github.com/rabilkhan786/financial-agent-crew/blob/main/app.py"
click node_api "https://github.com/rabilkhan786/financial-agent-crew/blob/main/api.py"
click node_graph "https://github.com/rabilkhan786/financial-agent-crew/blob/main/src/core/graph.py"
click node_orchestrator "https://github.com/rabilkhan786/financial-agent-crew/blob/main/src/agents/orchestrator.py"
click node_market_research "https://github.com/rabilkhan786/financial-agent-crew/blob/main/src/agents/market_researcher.py"
click node_fundamentals "https://github.com/rabilkhan786/financial-agent-crew/blob/main/src/agents/fundamentals_analyst.py"
click node_data_analyst "https://github.com/rabilkhan786/financial-agent-crew/blob/main/src/agents/data_analyst.py"
click node_report_writer "https://github.com/rabilkhan786/financial-agent-crew/blob/main/src/agents/report_writer.py"
click node_market_data "https://github.com/rabilkhan786/financial-agent-crew/blob/main/src/tools/market_data.py"
click node_statements "https://github.com/rabilkhan786/financial-agent-crew/blob/main/src/tools/statements.py"
click node_ratios "https://github.com/rabilkhan786/financial-agent-crew/blob/main/src/tools/ratios.py"
click node_kpi "https://github.com/rabilkhan786/financial-agent-crew/blob/main/src/tools/kpi.py"
click node_news "https://github.com/rabilkhan786/financial-agent-crew/blob/main/src/tools/news.py"
click node_social "https://github.com/rabilkhan786/financial-agent-crew/blob/main/src/tools/social.py"
click node_charts "https://github.com/rabilkhan786/financial-agent-crew/blob/main/src/utils/charts.py"
click node_formatting "https://github.com/rabilkhan786/financial-agent-crew/blob/main/src/utils/formatting.py"
click node_serialization "https://github.com/rabilkhan786/financial-agent-crew/blob/main/src/utils/serialization.py"
click node_pdf "https://github.com/rabilkhan786/financial-agent-crew/blob/main/src/utils/report_pdf.py"
click node_llm "https://github.com/rabilkhan786/financial-agent-crew/blob/main/src/core/llm.py"
click node_config "https://github.com/rabilkhan786/financial-agent-crew/blob/main/src/components/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_streamlit,node_api,node_user toneBlue
class node_graph,node_orchestrator toneAmber
class node_market_research,node_fundamentals,node_data_analyst,node_market_data,node_statements,node_ratios,node_kpi,node_news,node_social toneMint
class node_report_writer,node_charts,node_formatting,node_serialization,node_pdf,node_llm,node_config toneRose
class node_yahoo,node_stocktwits,node_groq toneIndigo
```

## Components

### User interfaces

- [Streamlit UI](https://github.com/rabilkhan786/financial-agent-crew/blob/main/app.py): `app.py`
- [FastAPI](https://github.com/rabilkhan786/financial-agent-crew/blob/main/api.py): `api.py`

### Agent workflow

- [LangGraph workflow](https://github.com/rabilkhan786/financial-agent-crew/blob/main/src/core/graph.py): `src/core/graph.py`
- [Orchestrator](https://github.com/rabilkhan786/financial-agent-crew/blob/main/src/agents/orchestrator.py): `src/agents/orchestrator.py`

### Research and analysis

- [Market researcher](https://github.com/rabilkhan786/financial-agent-crew/blob/main/src/agents/market_researcher.py): `src/agents/market_researcher.py`
- [Fundamentals analyst](https://github.com/rabilkhan786/financial-agent-crew/blob/main/src/agents/fundamentals_analyst.py): `src/agents/fundamentals_analyst.py`
- [Data analyst](https://github.com/rabilkhan786/financial-agent-crew/blob/main/src/agents/data_analyst.py): `src/agents/data_analyst.py`
- [Market data](https://github.com/rabilkhan786/financial-agent-crew/blob/main/src/tools/market_data.py): `src/tools/market_data.py`
- [Financial statements](https://github.com/rabilkhan786/financial-agent-crew/blob/main/src/tools/statements.py): `src/tools/statements.py`
- [Fundamental metrics](https://github.com/rabilkhan786/financial-agent-crew/blob/main/src/tools/ratios.py): `src/tools/ratios.py`
- [Price KPIs](https://github.com/rabilkhan786/financial-agent-crew/blob/main/src/tools/kpi.py): `src/tools/kpi.py`
- [News retrieval](https://github.com/rabilkhan786/financial-agent-crew/blob/main/src/tools/news.py): `src/tools/news.py`
- [Social sentiment](https://github.com/rabilkhan786/financial-agent-crew/blob/main/src/tools/social.py): `src/tools/social.py`

### Report and shared services

- [Report writer](https://github.com/rabilkhan786/financial-agent-crew/blob/main/src/agents/report_writer.py): `src/agents/report_writer.py`
- [Chart generation](https://github.com/rabilkhan786/financial-agent-crew/blob/main/src/utils/charts.py): `src/utils/charts.py`
- [Metric formatting](https://github.com/rabilkhan786/financial-agent-crew/blob/main/src/utils/formatting.py): `src/utils/formatting.py`
- [State serialization](https://github.com/rabilkhan786/financial-agent-crew/blob/main/src/utils/serialization.py): `src/utils/serialization.py`
- [PDF reporting](https://github.com/rabilkhan786/financial-agent-crew/blob/main/src/utils/report_pdf.py): `src/utils/report_pdf.py`
- [LLM client](https://github.com/rabilkhan786/financial-agent-crew/blob/main/src/core/llm.py): `src/core/llm.py`
- [Configuration](https://github.com/rabilkhan786/financial-agent-crew/blob/main/src/components/config.py): `src/components/config.py`

### Other components

- **User**
- **Yahoo Finance**
- **StockTwits**
- **Groq model**

## Connections

- User → Streamlit UI: enters ticker and dates (evidence: `README.md`)
- Streamlit UI → FastAPI: submits analysis (evidence: `README.md`)
- FastAPI → LangGraph workflow: runs workflow (evidence: `api.py`)
- LangGraph workflow → Orchestrator: starts intake (evidence: `src/core/graph.py`)
- Orchestrator → Market data: fetches profile (evidence: `src/agents/orchestrator.py`)
- LangGraph workflow → Market researcher: dispatches (evidence: `src/core/graph.py`)
- Market researcher → News retrieval: fetches headlines (evidence: `src/agents/market_researcher.py`)
- Market researcher → Social sentiment: fetches posts (evidence: `src/agents/market_researcher.py`)
- Market researcher → LLM client: summarizes context (evidence: `src/agents/market_researcher.py`)
- LangGraph workflow → Fundamentals analyst: dispatches (evidence: `src/core/graph.py`)
- Fundamentals analyst → Financial statements: fetches statements (evidence: `src/agents/fundamentals_analyst.py`)
- Fundamentals analyst → Market data: fetches price history (evidence: `src/agents/fundamentals_analyst.py`)
- Fundamentals analyst → Fundamental metrics: calculates metrics (evidence: `src/agents/fundamentals_analyst.py`)
- Fundamentals analyst → Metric formatting: formats findings (evidence: `src/agents/fundamentals_analyst.py`)
- Fundamentals analyst → LLM client: explains results (evidence: `src/agents/fundamentals_analyst.py`)
- LangGraph workflow → Data analyst: dispatches (evidence: `src/core/graph.py`)
- Data analyst → Market data: fetches prices (evidence: `src/agents/data_analyst.py`)
- Data analyst → Price KPIs: calculates performance (evidence: `src/agents/data_analyst.py`)
- Data analyst → Chart generation: builds charts (evidence: `src/agents/data_analyst.py`)
- Data analyst → LLM client: explains metrics (evidence: `src/agents/data_analyst.py`)
- LangGraph workflow → Report writer: dispatches (evidence: `src/core/graph.py`)
- Report writer → Metric formatting: formats findings (evidence: `src/agents/report_writer.py`)
- Report writer → LLM client: writes report (evidence: `src/agents/report_writer.py`)
- LangGraph workflow → Orchestrator: routes review (evidence: `src/core/graph.py`)
- Orchestrator → LLM client: reviews report (evidence: `src/agents/orchestrator.py`)
- Market data → Yahoo Finance: requests market data (evidence: `src/tools/market_data.py`)
- News retrieval → Yahoo Finance: fetches company news (evidence: `README.md`)
- Social sentiment → StockTwits: fetches sentiment posts (evidence: `README.md`)
- LLM client → Groq model: invokes model (evidence: `src/core/llm.py`)
- FastAPI → PDF reporting: creates PDF (evidence: `api.py`)
- FastAPI → State serialization: serializes response (evidence: `api.py`)
- Streamlit UI → State serialization: uses report data (evidence: `app.py`)
- Streamlit UI → Metric formatting: formats display (evidence: `app.py`)
- Chart generation → Fundamental metrics: uses metric threshold (evidence: `src/utils/charts.py`)
- LLM client → Configuration: loads model settings (evidence: `src/core/llm.py`)
