TradingAgents: Multi-Agent LLM Framework for Financial Trading

TradingAgents is a groundbreaking open-source framework that brings the power of multi-agent LLM systems to financial trading. Developed by TauricResearch, this framework mirrors the dynamics of real-world trading firms by deploying specialized AI agents that collaboratively evaluate market conditions and inform trading decisions. With over 49,000 stars on GitHub, it has become one of the most popular AI-powered trading frameworks in the open-source community.

What is TradingAgents?

TradingAgents is a multi-agent trading framework that simulates the collaborative decision-making process found in professional trading firms. Instead of relying on a single AI model, the framework deploys multiple specialized agents, each with distinct roles: fundamental analysts, sentiment experts, technical analysts, researchers, traders, and risk management teams. These agents engage in dynamic discussions and debates to pinpoint optimal trading strategies.

The framework is built on LangGraph, ensuring flexibility and modularity in agent orchestration. It supports multiple LLM providers including OpenAI (GPT-5.x), Google (Gemini 3.x), Anthropic (Claude 4.x), xAI (Grok 4.x), OpenRouter, and Ollama for local models. This multi-provider support allows users to choose the best model for their specific use case and budget.

TradingAgents Architecture

Understanding the Multi-Agent Architecture

The architecture diagram above illustrates the sophisticated multi-agent system that powers TradingAgents. This design represents a paradigm shift from traditional single-model approaches to a collaborative, role-based framework that mirrors how professional trading firms operate.

Input Layer: Ticker and Date

The system begins with two fundamental inputs: the ticker symbol (such as NVDA for NVIDIA) and the analysis date. These inputs drive all subsequent data collection and analysis activities. The ticker symbol identifies the specific stock or financial instrument to analyze, while the date allows for historical analysis and backtesting capabilities. This temporal dimension is crucial for understanding how market conditions evolve over time and for validating trading strategies against past performance.

Data Layer: Multiple Data Sources

The framework integrates with multiple data APIs to gather comprehensive market intelligence. Yahoo Finance and Alpha Vantage serve as primary data sources, providing real-time and historical market data. The data layer includes four distinct categories:

  • Market Data APIs: Provide stock prices, trading volumes, and technical indicators essential for quantitative analysis.
  • News Data APIs: Deliver global news, company announcements, and macroeconomic indicators that influence market sentiment.
  • Fundamentals Data APIs: Supply financial statements, balance sheets, cash flow data, and income statements for fundamental analysis.
  • Social Media Data APIs: Aggregate social media sentiment and public opinion to gauge market mood and potential short-term price movements.

Analyst Team: Specialized Intelligence

The analyst team consists of four specialized agents, each focusing on a distinct aspect of market analysis:

  1. Market Analyst: Utilizes technical indicators like MACD (Moving Average Convergence Divergence) and RSI (Relative Strength Index) to detect trading patterns and forecast price movements. This agent processes raw market data to identify trends, support/resistance levels, and potential breakout points.

  2. News Analyst: Monitors global news and macroeconomic indicators, interpreting the impact of events on market conditions. This agent understands that news events can cause sudden market shifts and incorporates this knowledge into its analysis.

  3. Fundamentals Analyst: Evaluates company financials and performance metrics, identifying intrinsic values and potential red flags. This agent examines balance sheets, income statements, and cash flow data to assess the financial health of companies.

  4. Sentiment Analyst: Analyzes social media and public sentiment using sentiment scoring algorithms to gauge short-term market mood. This agent recognizes that market sentiment can drive price movements independent of fundamental factors.

Research Team: Bull and Bear Debate

The research team comprises bullish and bearish researchers who critically assess the insights provided by the analyst team. Through structured debates, they balance potential gains against inherent risks. This adversarial approach ensures that both optimistic and pessimistic scenarios are thoroughly examined before making trading decisions.

The Research Manager acts as a debate moderator, synthesizing arguments from both sides and ensuring productive discourse. This role is crucial for maintaining balanced analysis and avoiding confirmation bias that can lead to poor trading decisions.

Trader Agent: Investment Planning

The Trader Agent composes reports from analysts and researchers to make informed trading decisions. It determines the timing and magnitude of trades based on comprehensive market insights. This agent considers not just the analysis results but also market liquidity, current portfolio positions, and optimal entry/exit points.

Risk Management Team: Multi-Perspective Assessment

The risk management team includes three debators with different risk perspectives:

  • Aggressive Debator: Advocates for higher-risk, higher-reward strategies, emphasizing growth potential and market opportunities.
  • Conservative Debator: Emphasizes capital preservation and risk mitigation, focusing on potential downsides and protective measures.
  • Neutral Debator: Provides balanced perspectives, weighing both opportunities and risks to find middle-ground solutions.

This multi-perspective approach ensures that trading decisions consider various risk appetites and market scenarios, leading to more robust investment strategies.

Portfolio Manager: Final Decision Authority

The Portfolio Manager serves as the final decision authority, evaluating and adjusting trading strategies based on risk assessment reports. This agent approves or rejects transaction proposals, and if approved, the order is sent to the simulated exchange for execution. The Portfolio Manager considers portfolio diversification, position sizing, and overall risk exposure when making final decisions.

Key Architectural Insights

This multi-agent architecture draws inspiration from how real trading firms operate, where different specialists contribute their expertise to collective decision-making. The framework implements several state-of-the-art design patterns:

  • Separation of Concerns: Each agent focuses on its specialized domain, ensuring deep expertise in each analysis area.
  • Adversarial Debate: The bull/bear and risk debate mechanisms ensure balanced analysis and reduce confirmation bias.
  • Hierarchical Decision-Making: Information flows from analysts to researchers to traders to risk management, with each level adding value and context.
  • Memory Systems: Agents maintain memory of past decisions and outcomes, enabling learning from experience and continuous improvement.

TradingAgents Workflow

Understanding the Trading Workflow

The workflow diagram above demonstrates the step-by-step process that TradingAgents follows to generate trading decisions. This systematic approach ensures thorough analysis and risk assessment before any trade is executed.

Step 1: Initialize Ticker and Date

The workflow begins with initialization, where users specify the ticker symbol and analysis date. This step sets the scope for all subsequent analysis. The framework supports any publicly traded stock with available data, making it versatile for various markets and instruments. The date parameter enables both real-time analysis (using current date) and historical backtesting (using past dates).

Step 2: Data Collection

Once initialized, the framework automatically collects data from multiple sources. This includes real-time market data, historical price information, news articles, financial statements, and social media sentiment. The data collection layer handles API rate limiting, caching, and error recovery to ensure reliable data access. Users can configure which data vendors to use (Yahoo Finance or Alpha Vantage) based on their preferences and API access.

Step 3: Analyst Reports

Each specialized analyst agent processes the collected data and generates detailed reports. The Market Analyst produces technical analysis reports with trend indicators and pattern recognition. The News Analyst creates summaries of relevant news events and their potential market impact. The Fundamentals Analyst generates financial health assessments with valuation metrics. The Sentiment Analyst provides sentiment scores and trend analysis from social media sources.

Step 4: Research Debate

The research team engages in structured debate, with bull researchers presenting optimistic arguments and bear researchers presenting pessimistic arguments. This debate format ensures comprehensive analysis from multiple perspectives. The Research Manager moderates the debate, ensuring productive discourse and synthesizing key points from both sides. The number of debate rounds is configurable, allowing users to balance thoroughness with computational cost.

Step 5: Investment Plan

Based on the analyst reports and research debate, the Trader Agent formulates an investment plan. This plan includes specific recommendations on position sizing, entry points, exit targets, and stop-loss levels. The investment plan considers not just the analysis results but also current portfolio positions, available capital, and market liquidity.

Step 6: Risk Assessment

The risk management team evaluates the proposed investment plan from multiple risk perspectives. The Aggressive Debator highlights potential upside and growth opportunities. The Conservative Debator emphasizes potential downsides and protective measures. The Neutral Debator provides balanced analysis. This multi-perspective risk assessment ensures that trading decisions are well-informed about potential outcomes.

Step 7: Portfolio Decision

The Portfolio Manager reviews the risk assessment and makes the final decision. This decision considers portfolio diversification, overall risk exposure, and alignment with investment objectives. The manager can approve the trade, request modifications, or reject the proposal entirely.

Step 8: Execute Trade

If approved, the trade is executed through the simulated exchange. The framework logs all decisions, analysis reports, and outcomes for future reference and learning. This comprehensive logging enables backtesting, performance analysis, and continuous improvement of trading strategies.

Feedback Loop: Continuous Improvement

A critical feature of the workflow is the feedback loop. If the Portfolio Manager rejects the proposal, the process returns to Step 5 for revision. This iterative approach ensures that only well-considered trades are executed. Additionally, after trade execution, the framework can reflect on outcomes and update agent memories, enabling learning from experience.

TradingAgents LLM Providers

Understanding LLM Provider Integration

The LLM providers diagram illustrates how TradingAgents achieves flexibility through its unified client factory pattern. This architecture allows seamless switching between different LLM providers without modifying core agent logic.

Multi-Provider Support

The framework supports six major LLM providers, each offering unique capabilities:

  1. OpenAI (GPT-5.4 Family): Provides state-of-the-art reasoning capabilities with models like GPT-5.4 for complex analysis and GPT-5.4-mini for quick tasks. OpenAI models excel at nuanced understanding and complex reasoning tasks.

  2. Google (Gemini 3.x): Offers competitive performance with thinking capabilities. Gemini models provide strong performance on analytical tasks with configurable thinking levels.

  3. Anthropic (Claude 4.x): Known for safety and reliability. Claude models offer effort control parameters that balance response quality with computational cost.

  4. xAI (Grok 4.x): Provides alternative perspectives with real-time information access. Grok models are particularly useful for news analysis and current events.

  5. OpenRouter: A unified API that provides access to multiple models through a single interface. This is useful for experimentation and comparing model performance.

  6. Ollama: Enables local model deployment for privacy-sensitive applications or cost optimization. Users can run models locally without API costs.

LLM Client Factory: Unified Interface

The LM Client Factory implements the factory pattern to provide a unified interface for all providers. This abstraction layer handles provider-specific authentication, API calls, and response parsing. Users simply specify the provider and model, and the factory creates the appropriate client instance.

The factory pattern offers several benefits:

  • Provider Independence: Core agent logic remains independent of specific LLM providers, making it easy to switch providers as better models become available.
  • Configuration Simplicity: Users only need to set their preferred provider and model in the configuration file, without worrying about provider-specific implementation details.
  • Error Handling: The factory handles provider-specific errors and rate limiting, providing consistent error handling across all providers.

Deep Thinking vs Quick Thinking LLMs

The framework distinguishes between two types of LLM usage:

Deep Thinking LLM: Used for complex reasoning tasks such as analyzing financial statements, interpreting news impact, and generating investment recommendations. These models prioritize accuracy and thoroughness over speed. Examples include GPT-5.4, Claude 4.6, and Gemini 3.1 Pro.

Quick Thinking LLM: Used for fast tasks such as data extraction, format conversion, and simple classifications. These models prioritize speed and cost-efficiency. Examples include GPT-5.4-mini, Claude 4.6 Haiku, and Gemini 3.1 Flash.

This dual-model approach optimizes both performance and cost. Complex analysis tasks use capable but expensive models, while routine tasks use faster and cheaper models.

Provider-Specific Features

Each provider offers unique features that the framework leverages:

  • OpenAI: Supports reasoning_effort parameter (low, medium, high) to control response quality and cost.
  • Google: Supports thinking_level parameter (minimal, low, medium, high) for controlling model deliberation.
  • Anthropic: Supports effort parameter for balancing response quality with computational cost.

These provider-specific features are exposed through the configuration system, allowing users to fine-tune model behavior for their specific use cases.

Core Framework Integration

The LLM clients integrate seamlessly with the TradingAgents framework. Agent prompts are designed to be model-agnostic, working effectively across different providers. The framework handles response parsing and validation, ensuring consistent behavior regardless of the underlying model.

This integration enables users to experiment with different models and providers to find the optimal configuration for their trading strategies. Some users may prefer OpenAI for its reasoning capabilities, while others may choose Anthropic for its safety features or Ollama for cost optimization.

TradingAgents Data Flow

Understanding the Data Flow Architecture

The data flow diagram illustrates how information moves through the TradingAgents framework, from raw data sources to actionable insights. This architecture ensures efficient data processing and transformation at each stage.

Data Sources: Yahoo Finance and Alpha Vantage

The framework supports two primary data vendors:

Yahoo Finance: A free, widely-used source for market data. Provides real-time and historical stock prices, basic financial statements, and news. Ideal for individual traders and researchers with limited budgets.

Alpha Vantage: A professional-grade data provider with comprehensive financial data. Offers more detailed fundamental data, technical indicators, and extended historical data. Requires an API key but provides higher data quality and reliability.

Users can configure which vendor to use for each data category through the configuration file. This flexibility allows users to optimize for cost, data quality, or specific data requirements.

Tool Nodes: Specialized Data Processing

The framework organizes data processing into specialized tool nodes:

Stock Data Tools: Handle market data retrieval including stock prices, trading volumes, and technical indicators. Functions include get_stock_data() for price information and get_indicators() for technical analysis.

News Tools: Process news articles and global events. Functions include get_news() for company-specific news and get_global_news() for macroeconomic events. Also includes get_insider_transactions() for tracking insider trading activity.

Fundamentals Tools: Retrieve and process financial statements. Functions include get_fundamentals() for key metrics, get_balance_sheet() for asset/liability data, get_cashflow() for cash flow analysis, and get_income_statement() for revenue/expense data.

Social Tools: Analyze social media sentiment and public opinion. These tools process social media data to generate sentiment scores and trend analysis.

Agent Processing: From Data to Insights

Each analyst agent uses specific tool nodes to process relevant data:

Market Analyst: Uses Stock Data Tools to analyze price movements, identify trends, and detect trading patterns. Generates technical analysis reports with actionable insights.

News Analyst: Uses News Tools to process news events and assess their market impact. Generates news analysis reports highlighting significant events and their potential effects.

Fundamentals Analyst: Uses Fundamentals Tools to evaluate company financial health. Generates fundamental analysis reports with valuation metrics and financial health indicators.

Sentiment Analyst: Uses Social Tools to gauge market sentiment. Generates sentiment reports with mood indicators and trend analysis.

Output: Comprehensive Analysis Reports

The data flow culminates in four comprehensive reports:

Market Report: Technical analysis with trend indicators, support/resistance levels, and pattern recognition. Helps traders understand price dynamics and potential entry/exit points.

News Report: Event impact analysis summarizing significant news and their expected market effects. Enables traders to position for or against expected market movements.

Fundamentals Report: Financial health assessment with valuation metrics and key ratios. Provides long-term investment perspective based on company fundamentals.

Sentiment Report: Market mood analysis with sentiment scores and trend indicators. Helps traders understand short-term market psychology and potential price movements.

Data Caching and Efficiency

The framework implements intelligent caching to minimize API calls and improve performance. Data is cached locally with configurable expiration times, reducing costs and improving response times for repeated queries. The caching system handles cache invalidation and refresh automatically, ensuring data freshness while optimizing efficiency.

Key Features

Multi-Agent Coordination

The framework’s standout feature is its sophisticated multi-agent coordination system. Unlike single-model approaches, TradingAgents leverages specialized agents that collaborate through structured communication patterns. Each agent maintains its own memory and state, enabling learning from past decisions and continuous improvement.

The coordination follows a hierarchical pattern where information flows from analysts to researchers to traders to risk management. At each level, agents add context and analysis, culminating in well-informed trading decisions. This hierarchical approach ensures that decisions consider multiple perspectives and risk factors.

LLM Integration

TradingAgents provides seamless integration with multiple LLM providers through its unified client factory. The framework supports:

  • OpenAI GPT-5.4 family for advanced reasoning
  • Google Gemini 3.x with thinking capabilities
  • Anthropic Claude 4.x with effort control
  • xAI Grok 4.x for real-time information
  • OpenRouter for multi-model access
  • Ollama for local model deployment

This flexibility allows users to choose the best model for their needs and budget. The framework handles provider-specific authentication, API calls, and response parsing transparently.

Trading Strategies

The framework supports various trading strategies through its configurable architecture:

  • Day Trading: Quick analysis with emphasis on technical indicators and sentiment
  • Swing Trading: Balanced analysis combining technical and fundamental factors
  • Long-term Investing: Deep fundamental analysis with emphasis on financial health
  • Backtesting: Historical analysis to validate strategies against past performance

Users can configure debate rounds, risk tolerance, and analysis depth to match their trading style.

Risk Management

The risk management system provides multi-perspective assessment through three debators:

  • Aggressive Debator: Highlights growth opportunities and potential upside
  • Conservative Debator: Emphasizes risk mitigation and capital preservation
  • Neutral Debator: Provides balanced analysis weighing both perspectives

This approach ensures that trading decisions consider various risk appetites and market scenarios.

Installation

Prerequisites

  • Python 3.11 or higher
  • Conda or pip package manager
  • API keys for chosen LLM providers

Quick Start

Clone the repository:

git clone https://github.com/TauricResearch/TradingAgents.git
cd TradingAgents

Create a virtual environment:

conda create -n tradingagents python=3.13
conda activate tradingagents

Install the package:

pip install .

Docker Installation

For containerized deployment:

cp .env.example .env  # Add your API keys
docker compose run --rm tradingagents

For local models with Ollama:

docker compose --profile ollama run --rm tradingagents-ollama

API Configuration

Set environment variables for your chosen LLM providers:

export OPENAI_API_KEY=...          # OpenAI (GPT)
export GOOGLE_API_KEY=...          # Google (Gemini)
export ANTHROPIC_API_KEY=...       # Anthropic (Claude)
export XAI_API_KEY=...             # xAI (Grok)
export OPENROUTER_API_KEY=...      # OpenRouter
export ALPHA_VANTAGE_API_KEY=...   # Alpha Vantage

Alternatively, copy .env.example to .env and fill in your keys:

cp .env.example .env

Usage Examples

CLI Usage

Launch the interactive CLI:

tradingagents          # Installed command
python -m cli.main     # Alternative: run directly from source

The CLI provides an interactive interface where you can:

  • Select ticker symbols for analysis
  • Choose analysis dates
  • Configure LLM providers
  • Set research depth and debate rounds
  • Track agent progress in real-time

Python API Usage

Basic usage with default configuration:

from tradingagents.graph.trading_graph import TradingAgentsGraph
from tradingagents.default_config import DEFAULT_CONFIG

ta = TradingAgentsGraph(debug=True, config=DEFAULT_CONFIG.copy())

# Forward propagate
_, decision = ta.propagate("NVDA", "2026-01-15")
print(decision)

Custom configuration with specific LLM settings:

from tradingagents.graph.trading_graph import TradingAgentsGraph
from tradingagents.default_config import DEFAULT_CONFIG

config = DEFAULT_CONFIG.copy()
config["llm_provider"] = "openai"        # openai, google, anthropic, xai, openrouter, ollama
config["deep_think_llm"] = "gpt-5.4"     # Model for complex reasoning
config["quick_think_llm"] = "gpt-5.4-mini" # Model for quick tasks
config["max_debate_rounds"] = 2

ta = TradingAgentsGraph(debug=True, config=config)
_, decision = ta.propagate("NVDA", "2026-01-15")
print(decision)

Configuration Options

The framework provides extensive configuration options:

DEFAULT_CONFIG = {
    "project_dir": "./",
    "results_dir": "./results",
    "llm_provider": "openai",
    "deep_think_llm": "gpt-5.4",
    "quick_think_llm": "gpt-5.4-mini",
    "backend_url": "https://api.openai.com/v1",
    "google_thinking_level": None,      # "high", "minimal", etc.
    "openai_reasoning_effort": None,   # "medium", "high", "low"
    "anthropic_effort": None,          # "high", "medium", "low"
    "output_language": "English",
    "max_debate_rounds": 1,
    "max_risk_discuss_rounds": 1,
    "max_recur_limit": 100,
    "data_vendors": {
        "core_stock_apis": "yfinance",
        "technical_indicators": "yfinance",
        "fundamental_data": "yfinance",
        "news_data": "yfinance",
    },
}

Comparison with Other Trading Frameworks

Feature TradingAgents Traditional Quant Single-Model LLM
Multi-Agent Architecture Yes No No
Adversarial Debate Yes No No
Risk Management Team Yes Limited No
Multiple LLM Providers Yes N/A Limited
Memory and Learning Yes Limited No
Backtesting Support Yes Yes Limited
Open Source Yes Varies Varies

TradingAgents distinguishes itself through its multi-agent architecture, adversarial debate mechanism, and comprehensive risk management. While traditional quantitative frameworks excel at technical analysis, they lack the nuanced understanding that LLM-powered agents provide. Single-model LLM approaches miss the collaborative decision-making and risk assessment that multi-agent systems offer.

Conclusion

TradingAgents represents a significant advancement in AI-powered trading frameworks. By combining multi-agent coordination, adversarial debate, and comprehensive risk management, it provides a sophisticated platform for financial decision-making. The framework’s support for multiple LLM providers, flexible configuration, and open-source nature make it accessible to researchers, traders, and developers alike.

The framework is designed for research purposes, and trading performance may vary based on factors including chosen backbone language models, model temperature, trading periods, and data quality. It is not intended as financial, investment, or trading advice.

For more information, visit the GitHub repository or read the technical paper.

Watch PyShine on YouTube

Contents