Skip to main content

Framework Architecture

TradingAgents employs a sophisticated multi-agent architecture that mirrors the organizational structure of professional trading firms. The framework is built using LangGraph to ensure flexibility and modularity.

System Overview

The TradingAgents framework consists of four main components that work together in a coordinated manner:

┌─────────────────────────────────────────────────────────────┐
│ TradingAgents Framework │
├─────────────────┬─────────────────┬─────────────────────────┤
│ Analyst Team │ Researcher Team │ Trading & Risk │
│ │ │ Management │
├─────────────────┼─────────────────┼─────────────────────────┤
│ • Fundamentals │ • Bullish │ • Trader Agent │
│ • Sentiment │ Researcher │ • Risk Management │
│ • News │ • Bearish │ • Portfolio Manager │
│ • Technical │ Researcher │ │
└─────────────────┴─────────────────┴─────────────────────────┘

Component Details

1. Analyst Team

The analyst team consists of four specialized agents:

  • Fundamentals Analyst: Evaluates company financials and performance metrics
  • Sentiment Analyst: Analyzes social media and public sentiment using sentiment scoring
  • News Analyst: Monitors global news and macroeconomic indicators
  • Technical Analyst: Utilizes technical indicators (MACD, RSI) to detect patterns

2. Researcher Team

The researcher team provides critical analysis through structured debate:

  • Bullish Researcher: Advocates for positive market positions
  • Bearish Researcher: Provides contrarian analysis and risk assessment
  • Debate Mechanism: Facilitates structured discussions between researchers

3. Trader Agent

The trader agent synthesizes information from all sources:

  • Composes comprehensive reports from analysts and researchers
  • Makes informed trading decisions based on collective insights
  • Determines optimal timing and magnitude of trades

4. Risk Management & Portfolio Manager

The final decision-making layer:

  • Risk Management: Continuously evaluates portfolio risk and market volatility
  • Portfolio Manager: Makes final approval/rejection decisions on trade proposals

Technical Implementation

LangGraph Architecture

TradingAgents is built on LangGraph, providing:

  • Modularity: Each agent is an independent, replaceable module
  • Flexibility: Easy to modify agent behaviors and interactions
  • Scalability: Support for adding new agents or modifying existing ones

LLM Integration

The framework supports multiple LLM configurations:

  • Deep Thinking Models: o1-preview for complex analysis
  • Fast Thinking Models: gpt-4o for quick responses
  • Cost-Effective Options: gpt-4o-mini and o1-mini for testing

Data Flow Architecture

Market Data → Analysts → Researchers → Trader → Risk Management → Decision
↑ ↓ ↓ ↓ ↓ ↓
API Sources Analysis Debate Strategy Risk Assessment Execution

Configuration System

The framework uses a comprehensive configuration system that allows customization of:

  • LLM Models: Choose different models for different agent types
  • Debate Rounds: Control the depth of researcher discussions
  • Data Sources: Toggle between online tools and cached data
  • Risk Parameters: Adjust risk tolerance and portfolio constraints

Scalability Considerations

The modular design enables:

  • Horizontal Scaling: Add more specialized analysts
  • Vertical Scaling: Enhance individual agent capabilities
  • Custom Implementations: Replace agents with domain-specific versions

Next Steps