# mrkhaled007/finagent-pro architecture

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

- Interactive diagram: https://gitdiagram.com/mrkhaled007/finagent-pro
- Repository: https://github.com/mrkhaled007/finagent-pro

## Overview

FinAgent Pro accepts a ticker request, checks for a recent cached analysis, gathers market, financial, and news data, then produces a research brief, model-based risk assessment, quality verdict, and HTML report before storing the result. The API entry point and pipeline orchestration are visible in the source index; the sampled sources show the agent and data-fetching calls. The risk model artifact and API route details were not sampled, so those links are omitted. The pipeline also logs progress and can reuse cached summaries.

Main entry points: [`orchestrator.py`](https://github.com/mrkhaled007/finagent-pro/blob/main/orchestrator.py) (Analysis pipeline), [`agents/research_agent.py`](https://github.com/mrkhaled007/finagent-pro/blob/main/agents/research_agent.py) (Research agent), [`agents/base_agent.py`](https://github.com/mrkhaled007/finagent-pro/blob/main/agents/base_agent.py) (Gemini agent client), [`tools/news.py`](https://github.com/mrkhaled007/finagent-pro/blob/main/tools/news.py) (News sentiment)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Request orchestration"]
  node_api["API entry<br/>[main.py]"]
  node_pipeline["Analysis pipeline<br/>[orchestrator.py]"]
end

subgraph group_research["Equity research"]
  node_research_agent["Research agent<br/>[research_agent.py]"]
  node_market_data["Stock data<br/>[stock_data.py]"]
  node_financial_data["Financial data<br/>[financials.py]"]
  node_news_data["News sentiment<br/>[news.py]"]
end

subgraph group_risk["Risk evaluation"]
  node_analyst["Risk analyst<br/>[analyst_agent.py]"]
  node_features["Feature engineering"]
  node_judge["Quality judge<br/>[judge_agent.py]"]
end

subgraph group_outputs["Reporting and memory"]
  node_report["HTML report<br/>[report_agent.py]"]
  node_memory["Analysis memory<br/>[memory_agent.py]"]
  node_chroma[("Persistent vector store")]
end

subgraph group_integrations["External data and AI"]
  node_base_agent["Gemini agent client<br/>[base_agent.py]"]
  node_config["Runtime configuration<br/>[config.py]"]
end

node_caller(("Ticker requester"))
node_yfinance{{"Yahoo Finance"}}
node_alpha_vantage{{"Alpha Vantage"}}
node_gemini{{"Gemini API"}}

node_caller -->|"submits ticker"| node_api
node_api -->|"calls pipeline"| node_pipeline
node_pipeline -->|"checks cache"| node_memory
node_memory -->|"reads and writes"| node_chroma
node_pipeline -->|"runs research"| node_research_agent
node_research_agent -->|"fetches prices"| node_market_data
node_research_agent -->|"fetches financials"| node_financial_data
node_research_agent -->|"fetches news"| node_news_data
node_market_data -->|"fetches market data"| node_yfinance
node_financial_data -->|"fetches statements"| node_yfinance
node_news_data -->|"requests headlines"| node_alpha_vantage
node_research_agent -->|"requests brief"| node_base_agent
node_analyst -->|"computes features"| node_features
node_features -->|"fetches history"| node_yfinance
node_analyst -->|"requests explanation"| node_base_agent
node_pipeline -->|"runs risk analysis"| node_analyst
node_pipeline -->|"evaluates outputs"| node_judge
node_judge -->|"requests evaluation"| node_base_agent
node_base_agent -->|"generates content"| node_gemini
node_base_agent -->|"reads settings"| node_config
node_news_data -->|"reads API key"| node_config
node_pipeline -->|"builds report"| node_report
node_pipeline -->|"stores analysis"| node_memory

click node_api "https://github.com/mrkhaled007/finagent-pro/blob/main/api/main.py"
click node_pipeline "https://github.com/mrkhaled007/finagent-pro/blob/main/orchestrator.py"
click node_research_agent "https://github.com/mrkhaled007/finagent-pro/blob/main/agents/research_agent.py"
click node_market_data "https://github.com/mrkhaled007/finagent-pro/blob/main/tools/stock_data.py"
click node_financial_data "https://github.com/mrkhaled007/finagent-pro/blob/main/tools/financials.py"
click node_news_data "https://github.com/mrkhaled007/finagent-pro/blob/main/tools/news.py"
click node_analyst "https://github.com/mrkhaled007/finagent-pro/blob/main/agents/analyst_agent.py"
click node_features "https://github.com/mrkhaled007/finagent-pro/blob/main/tools/feature_engineering.py"
click node_judge "https://github.com/mrkhaled007/finagent-pro/blob/main/agents/judge_agent.py"
click node_base_agent "https://github.com/mrkhaled007/finagent-pro/blob/main/agents/base_agent.py"
click node_config "https://github.com/mrkhaled007/finagent-pro/blob/main/config.py"
click node_report "https://github.com/mrkhaled007/finagent-pro/blob/main/agents/report_agent.py"
click node_memory "https://github.com/mrkhaled007/finagent-pro/blob/main/memory/memory_agent.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_api,node_pipeline toneBlue
class node_research_agent,node_market_data,node_financial_data,node_news_data toneAmber
class node_analyst,node_features,node_judge,node_caller,node_gemini toneMint
class node_report,node_memory,node_chroma toneRose
class node_base_agent,node_config,node_yfinance,node_alpha_vantage toneIndigo
```

## Components

### Request orchestration

- [API entry](https://github.com/mrkhaled007/finagent-pro/blob/main/api/main.py): `api/main.py`
- [Analysis pipeline](https://github.com/mrkhaled007/finagent-pro/blob/main/orchestrator.py): `orchestrator.py`

### Equity research

- [Research agent](https://github.com/mrkhaled007/finagent-pro/blob/main/agents/research_agent.py): `agents/research_agent.py`
- [Stock data](https://github.com/mrkhaled007/finagent-pro/blob/main/tools/stock_data.py): `tools/stock_data.py`
- [Financial data](https://github.com/mrkhaled007/finagent-pro/blob/main/tools/financials.py): `tools/financials.py`
- [News sentiment](https://github.com/mrkhaled007/finagent-pro/blob/main/tools/news.py): `tools/news.py`

### Risk evaluation

- [Risk analyst](https://github.com/mrkhaled007/finagent-pro/blob/main/agents/analyst_agent.py): `agents/analyst_agent.py`
- [Feature engineering](https://github.com/mrkhaled007/finagent-pro/blob/main/tools/feature_engineering.py): `tools/feature_engineering.py`
- [Quality judge](https://github.com/mrkhaled007/finagent-pro/blob/main/agents/judge_agent.py): `agents/judge_agent.py`

### Reporting and memory

- [HTML report](https://github.com/mrkhaled007/finagent-pro/blob/main/agents/report_agent.py): `agents/report_agent.py`
- [Analysis memory](https://github.com/mrkhaled007/finagent-pro/blob/main/memory/memory_agent.py): `memory/memory_agent.py`
- **Persistent vector store**

### External data and AI

- [Gemini agent client](https://github.com/mrkhaled007/finagent-pro/blob/main/agents/base_agent.py): `agents/base_agent.py`
- [Runtime configuration](https://github.com/mrkhaled007/finagent-pro/blob/main/config.py): `config.py`

### Other components

- **Ticker requester**
- **Yahoo Finance**
- **Alpha Vantage**
- **Gemini API**

## Connections

- Ticker requester → API entry: submits ticker
- API entry → Analysis pipeline: calls pipeline (evidence: `api/main.py`)
- Analysis pipeline → Analysis memory: checks cache (evidence: `orchestrator.py`)
- Analysis memory → Persistent vector store: reads and writes (evidence: `memory/memory_agent.py`)
- Analysis pipeline → Research agent: runs research (evidence: `orchestrator.py`)
- Research agent → Stock data: fetches prices (evidence: `agents/research_agent.py`)
- Research agent → Financial data: fetches financials (evidence: `agents/research_agent.py`)
- Research agent → News sentiment: fetches news (evidence: `agents/research_agent.py`)
- Stock data → Yahoo Finance: fetches market data (evidence: `tools/stock_data.py`)
- Financial data → Yahoo Finance: fetches statements (evidence: `tools/financials.py`)
- News sentiment → Alpha Vantage: requests headlines (evidence: `tools/news.py`)
- Research agent → Gemini agent client: requests brief (evidence: `agents/research_agent.py`)
- Risk analyst → Feature engineering: computes features (evidence: `agents/analyst_agent.py`)
- Feature engineering → Yahoo Finance: fetches history (evidence: `tools/feature_engineering.py`)
- Risk analyst → Gemini agent client: requests explanation (evidence: `agents/analyst_agent.py`)
- Analysis pipeline → Risk analyst: runs risk analysis (evidence: `orchestrator.py`)
- Analysis pipeline → Quality judge: evaluates outputs (evidence: `orchestrator.py`)
- Quality judge → Gemini agent client: requests evaluation (evidence: `agents/judge_agent.py`)
- Gemini agent client → Gemini API: generates content (evidence: `agents/base_agent.py`)
- Gemini agent client → Runtime configuration: reads settings (evidence: `agents/base_agent.py`)
- News sentiment → Runtime configuration: reads API key (evidence: `tools/news.py`)
- Analysis pipeline → HTML report: builds report (evidence: `orchestrator.py`)
- Analysis pipeline → Analysis memory: stores analysis (evidence: `orchestrator.py`)
