# sharan-g-s/marketpulse-ai-agents architecture

> Architecture diagram of the GitHub repository sharan-g-s/marketpulse-ai-agents, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sharan-g-s/marketpulse-ai-agents
- Repository: https://github.com/sharan-g-s/marketpulse-ai-agents

## Overview

MarketPulse is a Streamlit financial-intelligence application whose main workflow accepts a ticker, gathers market and news data, analyzes sentiment and risk, optionally evaluates a portfolio, generates alerts, and produces an investment report. Its LangGraph workflow coordinates the agents over shared state; the UI also exposes separate market-analysis tools and dashboards. The README documents these additional capabilities, but their page-level implementations were not sampled, so they are represented at subsystem level.

Main entry points: [`graph/workflow.py`](https://github.com/sharan-g-s/marketpulse-ai-agents/blob/main/graph/workflow.py) (LangGraph workflow), [`graph/state.py`](https://github.com/sharan-g-s/marketpulse-ai-agents/blob/main/graph/state.py) (Shared analysis state), [`agents/news_agent.py`](https://github.com/sharan-g-s/marketpulse-ai-agents/blob/main/agents/news_agent.py) (News collection), [`agents/watchlist_agent.py`](https://github.com/sharan-g-s/marketpulse-ai-agents/blob/main/agents/watchlist_agent.py) (Watchlist analysis)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["User experience"]
  node_dashboard["Main dashboard<br/>[app.py]"]
  node_analysis_pages["Analysis pages"]
  node_themes["UI themes<br/>[theme.py]"]
end

subgraph group_orchestration["Analysis workflow"]
  node_workflow["LangGraph workflow<br/>[workflow.py]"]
  node_state["Shared analysis state<br/>[state.py]"]
end

subgraph group_agents["Analysis agents"]
  node_news_agent["News collection<br/>[news_agent.py]"]
  node_stock_agent["Stock data"]
  node_watchlist_agent["Watchlist analysis<br/>[watchlist_agent.py]"]
  node_sentiment_agent["News sentiment<br/>[sentiment_agent.py]"]
  node_risk_agent["Risk analysis"]
  node_portfolio_agent["Portfolio tracking"]
  node_alert_agent["Alert evaluation<br/>[alert_engine.py]"]
  node_report_agent["Investment report<br/>[report_agent.py]"]
end

subgraph group_analytics["Market analytics"]
  node_market_data["Stock data tools<br/>[stock_tools.py]"]
  node_technical["Technical indicators<br/>[indicators.py]"]
  node_news_tools["News tools<br/>[news_tools.py]"]
  node_market_features["Market analysis tools"]
end

node_investor(("Investor"))
node_external_data["Market and news providers"]
node_llm["Language model"]

node_investor -->|"uses"| node_dashboard
node_investor -->|"explores"| node_analysis_pages
node_dashboard -->|"runs analysis"| node_workflow
node_workflow -->|"dispatches"| node_news_agent
node_workflow -->|"dispatches"| node_stock_agent
node_workflow -->|"dispatches"| node_watchlist_agent
node_workflow -->|"dispatches"| node_sentiment_agent
node_workflow -->|"dispatches"| node_risk_agent
node_workflow -->|"dispatches"| node_portfolio_agent
node_workflow -->|"dispatches"| node_alert_agent
node_workflow -->|"dispatches"| node_report_agent
node_workflow -->|"passes state"| node_state
node_news_agent -->|"updates"| node_state
node_stock_agent -->|"uses"| node_market_data
node_stock_agent -->|"updates"| node_state
node_news_agent -->|"uses"| node_news_tools
node_news_agent -->|"updates"| node_state
node_watchlist_agent -->|"uses"| node_market_data
node_watchlist_agent -->|"uses"| node_technical
node_watchlist_agent -->|"updates"| node_state
node_sentiment_agent -->|"updates"| node_state
node_risk_agent -->|"updates"| node_state
node_portfolio_agent -->|"fetches prices"| node_market_data
node_portfolio_agent -->|"updates"| node_state
node_alert_agent -->|"evaluates"| node_state
node_report_agent -->|"reads analysis"| node_state
node_market_data -.->|"fetches quotes"| node_external_data
node_news_tools -.->|"fetches news"| node_external_data
node_analysis_pages -->|"offers analytics"| node_market_features
node_analysis_pages -.->|"uses styling"| node_themes
node_sentiment_agent -.->|"scores articles"| node_llm

click node_dashboard "https://github.com/sharan-g-s/marketpulse-ai-agents/blob/main/ui/app.py"
click node_analysis_pages "https://github.com/sharan-g-s/marketpulse-ai-agents/tree/main/ui/pages"
click node_themes "https://github.com/sharan-g-s/marketpulse-ai-agents/blob/main/ui/theme.py"
click node_workflow "https://github.com/sharan-g-s/marketpulse-ai-agents/blob/main/graph/workflow.py"
click node_state "https://github.com/sharan-g-s/marketpulse-ai-agents/blob/main/graph/state.py"
click node_news_agent "https://github.com/sharan-g-s/marketpulse-ai-agents/blob/main/agents/news_agent.py"
click node_stock_agent "https://github.com/sharan-g-s/marketpulse-ai-agents/blob/main/agents/stock_data_agent.py"
click node_watchlist_agent "https://github.com/sharan-g-s/marketpulse-ai-agents/blob/main/agents/watchlist_agent.py"
click node_sentiment_agent "https://github.com/sharan-g-s/marketpulse-ai-agents/blob/main/agents/sentiment_agent.py"
click node_risk_agent "https://github.com/sharan-g-s/marketpulse-ai-agents/blob/main/agents/risk_analyst_agent.py"
click node_portfolio_agent "https://github.com/sharan-g-s/marketpulse-ai-agents/blob/main/agents/portfolio_tracker.py"
click node_alert_agent "https://github.com/sharan-g-s/marketpulse-ai-agents/blob/main/agents/alert_engine.py"
click node_report_agent "https://github.com/sharan-g-s/marketpulse-ai-agents/blob/main/agents/report_agent.py"
click node_market_data "https://github.com/sharan-g-s/marketpulse-ai-agents/blob/main/tools/stock_tools.py"
click node_technical "https://github.com/sharan-g-s/marketpulse-ai-agents/blob/main/tools/indicators.py"
click node_news_tools "https://github.com/sharan-g-s/marketpulse-ai-agents/blob/main/tools/news_tools.py"
click node_market_features "https://github.com/sharan-g-s/marketpulse-ai-agents/tree/main/tools"

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_analysis_pages,node_themes toneBlue
class node_workflow,node_state toneAmber
class node_news_agent,node_stock_agent,node_watchlist_agent,node_sentiment_agent,node_risk_agent,node_portfolio_agent,node_alert_agent,node_report_agent toneMint
class node_market_data,node_technical,node_news_tools,node_market_features toneRose
class node_investor,node_external_data,node_llm toneIndigo
```

## Components

### User experience

- [Main dashboard](https://github.com/sharan-g-s/marketpulse-ai-agents/blob/main/ui/app.py): `ui/app.py`
- [Analysis pages](https://github.com/sharan-g-s/marketpulse-ai-agents/tree/main/ui/pages): `ui/pages`
- [UI themes](https://github.com/sharan-g-s/marketpulse-ai-agents/blob/main/ui/theme.py): `ui/theme.py`

### Analysis workflow

- [LangGraph workflow](https://github.com/sharan-g-s/marketpulse-ai-agents/blob/main/graph/workflow.py): `graph/workflow.py`
- [Shared analysis state](https://github.com/sharan-g-s/marketpulse-ai-agents/blob/main/graph/state.py): `graph/state.py`

### Analysis agents

- [News collection](https://github.com/sharan-g-s/marketpulse-ai-agents/blob/main/agents/news_agent.py): `agents/news_agent.py`
- [Stock data](https://github.com/sharan-g-s/marketpulse-ai-agents/blob/main/agents/stock_data_agent.py): `agents/stock_data_agent.py`
- [Watchlist analysis](https://github.com/sharan-g-s/marketpulse-ai-agents/blob/main/agents/watchlist_agent.py): `agents/watchlist_agent.py`
- [News sentiment](https://github.com/sharan-g-s/marketpulse-ai-agents/blob/main/agents/sentiment_agent.py): `agents/sentiment_agent.py`
- [Risk analysis](https://github.com/sharan-g-s/marketpulse-ai-agents/blob/main/agents/risk_analyst_agent.py): `agents/risk_analyst_agent.py`
- [Portfolio tracking](https://github.com/sharan-g-s/marketpulse-ai-agents/blob/main/agents/portfolio_tracker.py): `agents/portfolio_tracker.py`
- [Alert evaluation](https://github.com/sharan-g-s/marketpulse-ai-agents/blob/main/agents/alert_engine.py): `agents/alert_engine.py`
- [Investment report](https://github.com/sharan-g-s/marketpulse-ai-agents/blob/main/agents/report_agent.py): `agents/report_agent.py`

### Market analytics

- [Stock data tools](https://github.com/sharan-g-s/marketpulse-ai-agents/blob/main/tools/stock_tools.py): `tools/stock_tools.py`
- [Technical indicators](https://github.com/sharan-g-s/marketpulse-ai-agents/blob/main/tools/indicators.py): `tools/indicators.py`
- [News tools](https://github.com/sharan-g-s/marketpulse-ai-agents/blob/main/tools/news_tools.py): `tools/news_tools.py`
- [Market analysis tools](https://github.com/sharan-g-s/marketpulse-ai-agents/tree/main/tools): `tools`

### Other components

- **Investor**
- **Market and news providers**
- **Language model**

## Connections

- Investor → Main dashboard: uses (evidence: `README.md`)
- Investor → Analysis pages: explores (evidence: `README.md`)
- Main dashboard → LangGraph workflow: runs analysis (evidence: `ui/app.py`)
- LangGraph workflow → News collection: dispatches (evidence: `graph/workflow.py`)
- LangGraph workflow → Stock data: dispatches (evidence: `graph/workflow.py`)
- LangGraph workflow → Watchlist analysis: dispatches (evidence: `graph/workflow.py`)
- LangGraph workflow → News sentiment: dispatches (evidence: `graph/workflow.py`)
- LangGraph workflow → Risk analysis: dispatches (evidence: `graph/workflow.py`)
- LangGraph workflow → Portfolio tracking: dispatches (evidence: `graph/workflow.py`)
- LangGraph workflow → Alert evaluation: dispatches (evidence: `graph/workflow.py`)
- LangGraph workflow → Investment report: dispatches (evidence: `graph/workflow.py`)
- LangGraph workflow → Shared analysis state: passes state (evidence: `graph/workflow.py`)
- News collection → Shared analysis state: updates (evidence: `graph/state.py`)
- Stock data → Stock data tools: uses (evidence: `agents/stock_data_agent.py`)
- Stock data → Shared analysis state: updates (evidence: `graph/state.py`)
- News collection → News tools: uses (evidence: `agents/news_agent.py`)
- News collection → Shared analysis state: updates (evidence: `graph/state.py`)
- Watchlist analysis → Stock data tools: uses (evidence: `agents/watchlist_agent.py`)
- Watchlist analysis → Technical indicators: uses (evidence: `agents/watchlist_agent.py`)
- Watchlist analysis → Shared analysis state: updates (evidence: `graph/state.py`)
- News sentiment → Shared analysis state: updates (evidence: `graph/state.py`)
- Risk analysis → Shared analysis state: updates (evidence: `graph/state.py`)
- Portfolio tracking → Stock data tools: fetches prices (evidence: `agents/portfolio_tracker.py`)
- Portfolio tracking → Shared analysis state: updates (evidence: `graph/state.py`)
- Alert evaluation → Shared analysis state: evaluates (evidence: `agents/alert_engine.py`)
- Investment report → Shared analysis state: reads analysis (evidence: `agents/report_agent.py`)
- Stock data tools → Market and news providers: fetches quotes
- News tools → Market and news providers: fetches news
- Analysis pages → Market analysis tools: offers analytics (evidence: `README.md`)
- Analysis pages → UI themes: uses styling (evidence: `ui/pages/2_About.py`)
- News sentiment → Language model: scores articles (evidence: `README.md`)
