# devfsoft/trading-agents-fork architecture

> Architecture diagram of the GitHub repository devfsoft/trading-agents-fork, 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/devfsoft/trading-agents-fork
- Repository: https://github.com/devfsoft/trading-agents-fork

## Overview

TradingAgents is a multi-agent financial research and decision-support framework. A user supplies an instrument and configuration through the CLI or package API; the trading graph coordinates analyst reports, bull/bear research and a research plan, trader proposal, risk debate, and portfolio decision, with reports as an output. The graph also covers data-provider access, configurable LLM clients, checkpointing, and persistent decision memory. README documents the domain workflow; source relationships below are limited to shown excerpts, SOURCE INDEX references, and README statements, so unsampled implementation details are not inferred.

Main entry points: [`tradingagents/graph/trading_graph.py`](https://github.com/devfsoft/trading-agents-fork/blob/main/tradingagents/graph/trading_graph.py) (Trading graph), [`tradingagents/dataflows`](https://github.com/devfsoft/trading-agents-fork/tree/main/tradingagents/dataflows) (Data providers), [`tradingagents/agents/analysts`](https://github.com/devfsoft/trading-agents-fork/tree/main/tradingagents/agents/analysts) (Analyst team), [`tradingagents/agents/managers/research_manager.py`](https://github.com/devfsoft/trading-agents-fork/blob/main/tradingagents/agents/managers/research_manager.py) (Research manager)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Entry and orchestration"]
  node_cli["CLI<br/>[main.py]"]
  node_graph["Trading graph<br/>[trading_graph.py]"]
  node_execution["Analyst execution"]
  node_routing["Graph routing"]
end

subgraph group_research["Research workflow"]
  node_analysts["Analyst team"]
  node_researchers["Bull and bear researchers"]
  node_research_manager["Research manager"]
  node_trader["Trader<br/>[trader.py]"]
  node_risk["Risk debate"]
  node_portfolio["Portfolio manager"]
  node_schemas["Decision schemas<br/>[schemas.py]"]
  node_states["Agent state<br/>[agent_states.py]"]
end

subgraph group_runtime["Runtime services"]
  node_llm["LLM clients"]
  node_llm_base["LLM client base<br/>[base_client.py]"]
  node_catalog["Model catalog<br/>[model_catalog.py]"]
  node_validators["Model validation<br/>[validators.py]"]
  node_defaults["Default configuration<br/>[default_config.py]"]
  node_checkpoint["Graph checkpointing<br/>[checkpointer.py]"]
  node_memory["Decision memory<br/>[memory.py]"]
  node_reports["Report writer<br/>[reporting.py]"]
end

subgraph group_data["Market data"]
  node_providers["Data providers"]
  node_data_config["Data configuration<br/>[config.py]"]
  node_symbol["Symbol normalization<br/>[symbol_utils.py]"]
  node_indicators["Technical indicators"]
end

node_user(("Investor or researcher"))

node_user -->|"enters via"| node_cli
node_cli -->|"invokes"| node_graph
node_graph -->|"uses"| node_execution
node_graph -->|"uses"| node_routing
node_execution -.->|"runs"| node_analysts
node_analysts -->|"inform debate"| node_researchers
node_researchers -->|"debate informs"| node_research_manager
node_research_manager -->|"plans for"| node_trader
node_trader -->|"proposes trade"| node_risk
node_risk -->|"assesses for"| node_portfolio
node_portfolio -.->|"returns decision"| node_user
node_research_manager -->|"uses types"| node_schemas
node_portfolio -->|"uses types"| node_schemas
node_routing -->|"reads state"| node_states
node_graph -->|"creates clients"| node_llm
node_llm -.->|"implements"| node_llm_base
node_validators -->|"checks models"| node_catalog
node_graph -->|"uses checkpointing"| node_checkpoint
node_graph -->|"uses memory"| node_memory
node_graph -->|"writes reports"| node_reports
node_analysts -->|"gather market evidence"| node_providers
node_providers -->|"uses configuration"| node_data_config
node_providers -->|"normalizes symbols"| node_symbol
node_providers -->|"uses indicators"| node_indicators
node_graph -->|"loads defaults"| node_defaults

click node_cli "https://github.com/devfsoft/trading-agents-fork/blob/main/cli/main.py"
click node_graph "https://github.com/devfsoft/trading-agents-fork/blob/main/tradingagents/graph/trading_graph.py"
click node_execution "https://github.com/devfsoft/trading-agents-fork/blob/main/tradingagents/graph/analyst_execution.py"
click node_routing "https://github.com/devfsoft/trading-agents-fork/blob/main/tradingagents/graph/conditional_logic.py"
click node_analysts "https://github.com/devfsoft/trading-agents-fork/tree/main/tradingagents/agents/analysts"
click node_researchers "https://github.com/devfsoft/trading-agents-fork/tree/main/tradingagents/agents/researchers"
click node_research_manager "https://github.com/devfsoft/trading-agents-fork/blob/main/tradingagents/agents/managers/research_manager.py"
click node_trader "https://github.com/devfsoft/trading-agents-fork/blob/main/tradingagents/agents/trader/trader.py"
click node_risk "https://github.com/devfsoft/trading-agents-fork/tree/main/tradingagents/agents/risk_mgmt"
click node_portfolio "https://github.com/devfsoft/trading-agents-fork/blob/main/tradingagents/agents/managers/portfolio_manager.py"
click node_schemas "https://github.com/devfsoft/trading-agents-fork/blob/main/tradingagents/agents/schemas.py"
click node_states "https://github.com/devfsoft/trading-agents-fork/blob/main/tradingagents/agents/utils/agent_states.py"
click node_providers "https://github.com/devfsoft/trading-agents-fork/tree/main/tradingagents/dataflows"
click node_data_config "https://github.com/devfsoft/trading-agents-fork/blob/main/tradingagents/dataflows/config.py"
click node_symbol "https://github.com/devfsoft/trading-agents-fork/blob/main/tradingagents/dataflows/symbol_utils.py"
click node_indicators "https://github.com/devfsoft/trading-agents-fork/blob/main/tradingagents/dataflows/stockstats_utils.py"
click node_llm "https://github.com/devfsoft/trading-agents-fork/tree/main/tradingagents/llm_clients"
click node_llm_base "https://github.com/devfsoft/trading-agents-fork/blob/main/tradingagents/llm_clients/base_client.py"
click node_catalog "https://github.com/devfsoft/trading-agents-fork/blob/main/tradingagents/llm_clients/model_catalog.py"
click node_validators "https://github.com/devfsoft/trading-agents-fork/blob/main/tradingagents/llm_clients/validators.py"
click node_defaults "https://github.com/devfsoft/trading-agents-fork/blob/main/tradingagents/default_config.py"
click node_checkpoint "https://github.com/devfsoft/trading-agents-fork/blob/main/tradingagents/graph/checkpointer.py"
click node_memory "https://github.com/devfsoft/trading-agents-fork/blob/main/tradingagents/agents/utils/memory.py"
click node_reports "https://github.com/devfsoft/trading-agents-fork/blob/main/tradingagents/reporting.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_graph,node_execution,node_routing toneBlue
class node_analysts,node_researchers,node_research_manager,node_trader,node_risk,node_portfolio,node_schemas,node_states toneAmber
class node_llm,node_llm_base,node_catalog,node_validators,node_defaults,node_checkpoint,node_memory,node_reports toneMint
class node_providers,node_data_config,node_symbol,node_indicators toneRose
class node_user toneIndigo
```

## Components

### Entry and orchestration

- [CLI](https://github.com/devfsoft/trading-agents-fork/blob/main/cli/main.py): `cli/main.py`
- [Trading graph](https://github.com/devfsoft/trading-agents-fork/blob/main/tradingagents/graph/trading_graph.py): `tradingagents/graph/trading_graph.py`
- [Analyst execution](https://github.com/devfsoft/trading-agents-fork/blob/main/tradingagents/graph/analyst_execution.py): `tradingagents/graph/analyst_execution.py`
- [Graph routing](https://github.com/devfsoft/trading-agents-fork/blob/main/tradingagents/graph/conditional_logic.py): `tradingagents/graph/conditional_logic.py`

### Research workflow

- [Analyst team](https://github.com/devfsoft/trading-agents-fork/tree/main/tradingagents/agents/analysts): `tradingagents/agents/analysts`
- [Bull and bear researchers](https://github.com/devfsoft/trading-agents-fork/tree/main/tradingagents/agents/researchers): `tradingagents/agents/researchers`
- [Research manager](https://github.com/devfsoft/trading-agents-fork/blob/main/tradingagents/agents/managers/research_manager.py): `tradingagents/agents/managers/research_manager.py`
- [Trader](https://github.com/devfsoft/trading-agents-fork/blob/main/tradingagents/agents/trader/trader.py): `tradingagents/agents/trader/trader.py`
- [Risk debate](https://github.com/devfsoft/trading-agents-fork/tree/main/tradingagents/agents/risk_mgmt): `tradingagents/agents/risk_mgmt`
- [Portfolio manager](https://github.com/devfsoft/trading-agents-fork/blob/main/tradingagents/agents/managers/portfolio_manager.py): `tradingagents/agents/managers/portfolio_manager.py`
- [Decision schemas](https://github.com/devfsoft/trading-agents-fork/blob/main/tradingagents/agents/schemas.py): `tradingagents/agents/schemas.py`
- [Agent state](https://github.com/devfsoft/trading-agents-fork/blob/main/tradingagents/agents/utils/agent_states.py): `tradingagents/agents/utils/agent_states.py`

### Runtime services

- [LLM clients](https://github.com/devfsoft/trading-agents-fork/tree/main/tradingagents/llm_clients): `tradingagents/llm_clients`
- [LLM client base](https://github.com/devfsoft/trading-agents-fork/blob/main/tradingagents/llm_clients/base_client.py): `tradingagents/llm_clients/base_client.py`
- [Model catalog](https://github.com/devfsoft/trading-agents-fork/blob/main/tradingagents/llm_clients/model_catalog.py): `tradingagents/llm_clients/model_catalog.py`
- [Model validation](https://github.com/devfsoft/trading-agents-fork/blob/main/tradingagents/llm_clients/validators.py): `tradingagents/llm_clients/validators.py`
- [Default configuration](https://github.com/devfsoft/trading-agents-fork/blob/main/tradingagents/default_config.py): `tradingagents/default_config.py`
- [Graph checkpointing](https://github.com/devfsoft/trading-agents-fork/blob/main/tradingagents/graph/checkpointer.py): `tradingagents/graph/checkpointer.py`
- [Decision memory](https://github.com/devfsoft/trading-agents-fork/blob/main/tradingagents/agents/utils/memory.py): `tradingagents/agents/utils/memory.py`
- [Report writer](https://github.com/devfsoft/trading-agents-fork/blob/main/tradingagents/reporting.py): `tradingagents/reporting.py`

### Market data

- [Data providers](https://github.com/devfsoft/trading-agents-fork/tree/main/tradingagents/dataflows): `tradingagents/dataflows`
- [Data configuration](https://github.com/devfsoft/trading-agents-fork/blob/main/tradingagents/dataflows/config.py): `tradingagents/dataflows/config.py`
- [Symbol normalization](https://github.com/devfsoft/trading-agents-fork/blob/main/tradingagents/dataflows/symbol_utils.py): `tradingagents/dataflows/symbol_utils.py`
- [Technical indicators](https://github.com/devfsoft/trading-agents-fork/blob/main/tradingagents/dataflows/stockstats_utils.py): `tradingagents/dataflows/stockstats_utils.py`

### Other components

- **Investor or researcher**

## Connections

- Investor or researcher → CLI: enters via (evidence: `README.md`)
- CLI → Trading graph: invokes (evidence: `cli/main.py`)
- Trading graph → Analyst execution: uses (evidence: `tradingagents/graph/trading_graph.py`)
- Trading graph → Graph routing: uses (evidence: `tradingagents/graph/trading_graph.py`)
- Analyst execution → Analyst team: runs
- Analyst team → Bull and bear researchers: inform debate (evidence: `README.md`)
- Bull and bear researchers → Research manager: debate informs (evidence: `README.md`)
- Research manager → Trader: plans for (evidence: `README.md`)
- Trader → Risk debate: proposes trade (evidence: `README.md`)
- Risk debate → Portfolio manager: assesses for (evidence: `README.md`)
- Portfolio manager → Investor or researcher: returns decision
- Research manager → Decision schemas: uses types (evidence: `tradingagents/agents/managers/research_manager.py`)
- Portfolio manager → Decision schemas: uses types (evidence: `tradingagents/agents/managers/portfolio_manager.py`)
- Graph routing → Agent state: reads state (evidence: `tradingagents/graph/conditional_logic.py`)
- Trading graph → LLM clients: creates clients (evidence: `tradingagents/graph/trading_graph.py`)
- LLM clients → LLM client base: implements (evidence: `tradingagents/llm_clients/openai_client.py`)
- Model validation → Model catalog: checks models (evidence: `tradingagents/llm_clients/validators.py`)
- Trading graph → Graph checkpointing: uses checkpointing (evidence: `tradingagents/graph/trading_graph.py`)
- Trading graph → Decision memory: uses memory (evidence: `tradingagents/graph/trading_graph.py`)
- Trading graph → Report writer: writes reports (evidence: `tradingagents/graph/trading_graph.py`)
- Analyst team → Data providers: gather market evidence (evidence: `README.md`)
- Data providers → Data configuration: uses configuration (evidence: `tradingagents/dataflows/interface.py`)
- Data providers → Symbol normalization: normalizes symbols (evidence: `tradingagents/dataflows/y_finance.py`)
- Data providers → Technical indicators: uses indicators (evidence: `tradingagents/dataflows/y_finance.py`)
- Trading graph → Default configuration: loads defaults (evidence: `tradingagents/graph/trading_graph.py`)
