TradingAgents: Multi-Agent AI Framework That Models a Hedge Fund

Architecture deep dive into TradingAgents - an open-source LangGraph framework where LLM agents (analysts, researchers, trader, risk management, portfolio manager) engage in structured debates to make trading decisions.

TradingAgents multi-agent system

Most AI trading projects are a single LLM fed data and asked to "make a decision." TradingAgents (GitHub, arXiv: 2412.20138) takes a different path: instead of one agent — an entire trading firm staff, where each role is a separate LLM agent with its own tools, data sources, and prompt.

Built on LangGraph, the framework creates a system that doesn't just "look at data" — it debates with itself before making a decision.

Architecture: From Data to Decision

Decision pipeline

The full pipeline is a directed acyclic graph (DAG) of 12 nodes:

Analyst Team → Research Debate → Trader → Risk Debate → Portfolio Manager → BUY/HOLD/SELL

Analyst Team: Four Specializations

AgentData SourcesFocus
Fundamentals AnalystBalance sheet, cashflow, income statementIntrinsic value vs market price
Sentiment AnalystYahoo Finance News, StockTwits, RedditMulti-source sentiment aggregation
News AnalystTicker news, macro headlines, insider transactionsEvent-driven signals
Technical AnalystOHLCV, MACD, RSI, Bollinger BandsPattern detection and momentum

Research Debate: Bull vs Bear

Agent debates

After analysts produce reports, adversarial debate begins:

  1. Bull Researcher builds the bullish thesis
  2. Bear Researcher builds the bearish counter-thesis
  3. Multi-round debate (configurable via max_debate_rounds)
  4. Research Manager (deep thinking LLM) synthesizes both positions

Risk Management: Triple Filter

The trader's proposal passes through three risk managers debating each other:

AgentProfile
Aggressive AnalystHigh risk tolerance, upside focus
Neutral AnalystBalanced risk/reward
Conservative AnalystLow risk tolerance, downside protection

Portfolio Manager: Final Decision

Receives trader proposal + risk debate results + reflective memory from past decisions. Approves, rejects, or adjusts the trade.

Reflective Memory

The system maintains a decision log. On each subsequent run for the same ticker, it fetches realized returns (raw + alpha vs SPY), generates reflections, and injects history into the Portfolio Manager prompt — creating learning from mistakes without fine-tuning.

Tech Stack

ComponentTechnology
OrchestrationLangGraph (StateGraph, checkpoints)
LLM ProvidersOpenAI, Google, Anthropic, xAI, DeepSeek, Qwen, Ollama, Azure
Market DatayFinance, Alpha Vantage
Social DataStockTwits API, Reddit API