# tauricresearch/tradingagents architecture

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

- Interactive diagram: https://gitdiagram.com/tauricresearch/tradingagents
- Repository: https://github.com/tauricresearch/tradingagents
- Video tour (about a minute): https://gitdiagram.com/tauricresearch/tradingagents/video

## Overview

TradingAgents is a multi-agent financial analysis and trading-decision framework, exposed through a CLI and package API. A run gathers market, company, news, sentiment and macro evidence, coordinates analyst reports and research/risk debate, then produces a rated portfolio decision. The graph also supports backtesting, checkpoint resume, decision memory and saved reports. The graph and agent stages are described in the README; source excerpts and the SOURCE INDEX substantiate selected module relationships. Unsampled wiring is omitted where it cannot be verified.

Main entry points: [`tradingagents/graph/trading_graph.py`](https://github.com/tauricresearch/tradingagents/blob/main/tradingagents/graph/trading_graph.py) (Trading Graph), [`cli/main.py`](https://github.com/tauricresearch/tradingagents/blob/main/cli/main.py) (Command Line), [`tradingagents/dataflows/router.py`](https://github.com/tauricresearch/tradingagents/blob/main/tradingagents/dataflows/router.py) (Data Router), [`cli/run.py`](https://github.com/tauricresearch/tradingagents/blob/main/cli/run.py) (Run Interface)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Run Entry"]
  node_cli["Command Line<br/>[main.py]"]
  node_runner["Run Interface<br/>[run.py]"]
  node_backtest["Backtesting<br/>[backtest.py]"]
end

subgraph group_orchestration["Analysis Workflow"]
  node_graph["Trading Graph<br/>[trading_graph.py]"]
  node_context["Run Context<br/>[context.py]"]
  node_analysts["Analyst Team"]
  node_researchers["Bull Bear Debate"]
  node_risk["Risk Debate"]
  node_research_manager["Research Manager"]
  node_trader["Trader<br/>[trader.py]"]
  node_portfolio_manager["Portfolio Manager"]
  node_rating["Decision Rating<br/>[rating.py]"]
end

subgraph group_data["Market Data"]
  node_router["Data Router<br/>[router.py]"]
  node_yahoo["Yahoo Feeds"]
  node_other_vendors["Other Data Vendors"]
  node_date_rules["Point-In-Time Rules<br/>[date_window.py]"]
end

subgraph group_providers["Model Providers"]
  node_llm_clients["LLM Clients"]
end

subgraph group_outcomes["Results And Memory"]
  node_memory[("Decision Memory")]
  node_reporting["Reports<br/>[reporting.py]"]
  node_portfolio["Portfolio Context<br/>[portfolio.py]"]
end

node_user(("Analyst"))

node_user -->|"starts analysis"| node_cli
node_cli -->|"runs analysis"| node_runner
node_runner -.->|"starts workflow"| node_graph
node_user -->|"requests backtest"| node_backtest
node_backtest -->|"runs dated analyses"| node_graph
node_graph -->|"coordinates analysis"| node_analysts
node_analysts -->|"reports inform debate"| node_researchers
node_researchers -.->|"debate informs plan"| node_research_manager
node_research_manager -.->|"provides investment plan"| node_trader
node_trader -.->|"plan enters debate"| node_risk
node_risk -->|"debate informs decision"| node_portfolio_manager
node_portfolio_manager -->|"produces rating"| node_rating
node_graph -->|"builds context"| node_context
node_context -->|"checks run date"| node_date_rules
node_graph -.->|"routes data requests"| node_router
node_router -->|"dispatches vendor calls"| node_yahoo
node_router -->|"dispatches vendor calls"| node_other_vendors
node_graph -->|"configures models"| node_llm_clients
node_graph -->|"stores decisions"| node_memory
node_graph -->|"creates reports"| node_reporting
node_cli -->|"accepts portfolio"| node_portfolio

click node_cli "https://github.com/tauricresearch/tradingagents/blob/main/cli/main.py"
click node_runner "https://github.com/tauricresearch/tradingagents/blob/main/cli/run.py"
click node_backtest "https://github.com/tauricresearch/tradingagents/blob/main/tradingagents/backtest.py"
click node_graph "https://github.com/tauricresearch/tradingagents/blob/main/tradingagents/graph/trading_graph.py"
click node_context "https://github.com/tauricresearch/tradingagents/blob/main/tradingagents/agents/context.py"
click node_analysts "https://github.com/tauricresearch/tradingagents/tree/main/tradingagents/agents/analysts"
click node_researchers "https://github.com/tauricresearch/tradingagents/tree/main/tradingagents/agents/researchers"
click node_risk "https://github.com/tauricresearch/tradingagents/tree/main/tradingagents/agents/risk_mgmt"
click node_research_manager "https://github.com/tauricresearch/tradingagents/blob/main/tradingagents/agents/managers/research_manager.py"
click node_trader "https://github.com/tauricresearch/tradingagents/blob/main/tradingagents/agents/trader/trader.py"
click node_portfolio_manager "https://github.com/tauricresearch/tradingagents/blob/main/tradingagents/agents/managers/portfolio_manager.py"
click node_rating "https://github.com/tauricresearch/tradingagents/blob/main/tradingagents/agents/rating.py"
click node_router "https://github.com/tauricresearch/tradingagents/blob/main/tradingagents/dataflows/router.py"
click node_yahoo "https://github.com/tauricresearch/tradingagents/tree/main/tradingagents/dataflows/vendors/yahoo"
click node_other_vendors "https://github.com/tauricresearch/tradingagents/tree/main/tradingagents/dataflows/vendors"
click node_date_rules "https://github.com/tauricresearch/tradingagents/blob/main/tradingagents/dataflows/date_window.py"
click node_llm_clients "https://github.com/tauricresearch/tradingagents/tree/main/tradingagents/llm_clients"
click node_memory "https://github.com/tauricresearch/tradingagents/tree/main/tradingagents/memory"
click node_reporting "https://github.com/tauricresearch/tradingagents/blob/main/tradingagents/reporting.py"
click node_portfolio "https://github.com/tauricresearch/tradingagents/blob/main/tradingagents/portfolio.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_cli,node_runner,node_backtest toneBlue
class node_graph,node_context,node_analysts,node_researchers,node_risk,node_research_manager,node_trader,node_portfolio_manager,node_rating toneAmber
class node_router,node_yahoo,node_other_vendors,node_date_rules toneMint
class node_llm_clients toneRose
class node_memory,node_reporting,node_portfolio,node_user toneIndigo
```

## Components

### Run Entry

- [Command Line](https://github.com/tauricresearch/tradingagents/blob/main/cli/main.py): `cli/main.py`
- [Run Interface](https://github.com/tauricresearch/tradingagents/blob/main/cli/run.py): `cli/run.py`
- [Backtesting](https://github.com/tauricresearch/tradingagents/blob/main/tradingagents/backtest.py): `tradingagents/backtest.py`

### Analysis Workflow

- [Trading Graph](https://github.com/tauricresearch/tradingagents/blob/main/tradingagents/graph/trading_graph.py): `tradingagents/graph/trading_graph.py`
- [Run Context](https://github.com/tauricresearch/tradingagents/blob/main/tradingagents/agents/context.py): `tradingagents/agents/context.py`
- [Analyst Team](https://github.com/tauricresearch/tradingagents/tree/main/tradingagents/agents/analysts): `tradingagents/agents/analysts`
- [Bull Bear Debate](https://github.com/tauricresearch/tradingagents/tree/main/tradingagents/agents/researchers): `tradingagents/agents/researchers`
- [Risk Debate](https://github.com/tauricresearch/tradingagents/tree/main/tradingagents/agents/risk_mgmt): `tradingagents/agents/risk_mgmt`
- [Research Manager](https://github.com/tauricresearch/tradingagents/blob/main/tradingagents/agents/managers/research_manager.py): `tradingagents/agents/managers/research_manager.py`
- [Trader](https://github.com/tauricresearch/tradingagents/blob/main/tradingagents/agents/trader/trader.py): `tradingagents/agents/trader/trader.py`
- [Portfolio Manager](https://github.com/tauricresearch/tradingagents/blob/main/tradingagents/agents/managers/portfolio_manager.py): `tradingagents/agents/managers/portfolio_manager.py`
- [Decision Rating](https://github.com/tauricresearch/tradingagents/blob/main/tradingagents/agents/rating.py): `tradingagents/agents/rating.py`

### Market Data

- [Data Router](https://github.com/tauricresearch/tradingagents/blob/main/tradingagents/dataflows/router.py): `tradingagents/dataflows/router.py`
- [Yahoo Feeds](https://github.com/tauricresearch/tradingagents/tree/main/tradingagents/dataflows/vendors/yahoo): `tradingagents/dataflows/vendors/yahoo`
- [Other Data Vendors](https://github.com/tauricresearch/tradingagents/tree/main/tradingagents/dataflows/vendors): `tradingagents/dataflows/vendors`
- [Point-In-Time Rules](https://github.com/tauricresearch/tradingagents/blob/main/tradingagents/dataflows/date_window.py): `tradingagents/dataflows/date_window.py`

### Model Providers

- [LLM Clients](https://github.com/tauricresearch/tradingagents/tree/main/tradingagents/llm_clients): `tradingagents/llm_clients`

### Results And Memory

- [Decision Memory](https://github.com/tauricresearch/tradingagents/tree/main/tradingagents/memory): `tradingagents/memory`
- [Reports](https://github.com/tauricresearch/tradingagents/blob/main/tradingagents/reporting.py): `tradingagents/reporting.py`
- [Portfolio Context](https://github.com/tauricresearch/tradingagents/blob/main/tradingagents/portfolio.py): `tradingagents/portfolio.py`

### Other components

- **Analyst**

## Connections

- Analyst → Command Line: starts analysis
- Command Line → Run Interface: runs analysis (evidence: `cli/main.py`)
- Run Interface → Trading Graph: starts workflow
- Analyst → Backtesting: requests backtest
- Backtesting → Trading Graph: runs dated analyses (evidence: `tradingagents/backtest.py`)
- Trading Graph → Analyst Team: coordinates analysis
- Analyst Team → Bull Bear Debate: reports inform debate
- Bull Bear Debate → Research Manager: debate informs plan
- Research Manager → Trader: provides investment plan
- Trader → Risk Debate: plan enters debate
- Risk Debate → Portfolio Manager: debate informs decision (evidence: `tradingagents/agents/managers/portfolio_manager.py`)
- Portfolio Manager → Decision Rating: produces rating (evidence: `tradingagents/agents/managers/portfolio_manager.py`)
- Trading Graph → Run Context: builds context (evidence: `tradingagents/graph/trading_graph.py`)
- Run Context → Point-In-Time Rules: checks run date (evidence: `tradingagents/agents/context.py`)
- Trading Graph → Data Router: routes data requests
- Data Router → Yahoo Feeds: dispatches vendor calls (evidence: `tradingagents/dataflows/router.py`)
- Data Router → Other Data Vendors: dispatches vendor calls (evidence: `tradingagents/dataflows/router.py`)
- Trading Graph → LLM Clients: configures models (evidence: `tradingagents/graph/trading_graph.py`)
- Trading Graph → Decision Memory: stores decisions (evidence: `tradingagents/graph/trading_graph.py`)
- Trading Graph → Reports: creates reports (evidence: `tradingagents/graph/trading_graph.py`)
- Command Line → Portfolio Context: accepts portfolio (evidence: `cli/main.py`)
