TradingAgents: Multi-Agents LLM Financial Trading Framework
TradingAgents: Multi-Agents LLM Financial Trading Framework
TRADINGAGENTS_* env-var configurability with API-key auto-detection, remote Ollama support, non-US alpha benchmarks, and ticker path-traversal hardening.🎉 TradingAgents officially released! We have received numerous inquiries about the work, and we would like to express our thanks for the enthusiasm in our community.
So we decided to fully open-source the framework. Looking forward to building impactful projects with you!
TradingAgents is a multi-agent trading framework that mirrors the dynamics of real-world trading firms. By deploying specialized LLM-powered agents: from fundamental analysts, sentiment experts, and technical analysts, to trader, risk management team, the platform collaboratively evaluates market conditions and informs trading decisions. Moreover, these agents engage in dynamic discussions to pinpoint the optimal strategy.
TradingAgents framework is designed for research purposes. Trading performance may vary based on many factors, including the chosen backbone language models, model temperature, trading periods, the quality of data, and other non-deterministic factors. It is not intended as financial, investment, or trading advice.
Our framework decomposes complex trading tasks into specialized roles.
Clone TradingAgents:
git clone https://github.com/TauricResearch/TradingAgents.git
cd TradingAgentsCreate a virtual environment in any of your favorite environment managers:
conda create -n tradingagents python=3.12
conda activate tradingagentsInstall the package and its dependencies:
pip install .Alternatively, run with Docker:
cp .env.example .env # add your API keys
docker compose run --rm tradingagentsFor local models with Ollama:
docker compose --profile ollama run --rm tradingagents-ollamaTradingAgents supports multiple LLM providers. Set the API key for your chosen provider:
…For Azure OpenAI, copy .env.enterprise.example to .env.enterprise and fill in your credentials.
For AWS Bedrock, install the extra with pip install ".[bedrock]", set llm_provider: "bedrock", configure AWS credentials (environment variables, ~/.aws/credentials, or an IAM role) and AWS_DEFAULT_REGION, and use a Bedrock model ID, e.g. us.anthropic.claude-opus-4-8-v1:0.
For local models, configure Ollama with llm_provider: "ollama". The default endpoint is http://localhost:11434/v1; set OLLAMA_BASE_URL to point at a remote ollama-serve. Pull models with ollama pull <name>, and pick "Custom model ID" in the CLI for any model not listed by default.
For any other OpenAI-compatible server (vLLM, LM Studio, llama.cpp, or a custom relay), use llm_provider: "openai_compatible" and set the endpoint via backend_url (or TRADINGAGENTS_LLM_BACKEND_URL), e.g. http://localhost:8000/v1 for vLLM or http://localhost:1234/v1 for LM Studio. The model is whatever your server serves. No key is needed for local servers; set OPENAI_COMPATIBLE_API_KEY when the endpoint requires one.
Alternatively, copy .env.example to .env and fill in your keys:
cp .env.example .envLaunch the interactive CLI:
tradingagents # installed command
python -m cli.main # alternative: run directly from sourceYou will see a screen where you can select your desired tickers, analysis date, LLM provider, research depth, and more.
TradingAgents works with any market Yahoo Finance covers, using the exchange-suffixed ticker. Company identity and the alpha benchmark resolve automatically per market.
AAPL, SPY0700.HK · Tokyo: 7203.T · London: AZN.LRELIANCE.NS, .BO · Canada: .TO · Australia: .AX.SS, Shenzhen .SZ (e.g. 600519.SS for Kweichow Moutai)BTC-USD, ETH-USDAn interface will appear showing results as they load, letting you track the agent's progress as it runs.
We built TradingAgents with LangGraph to ensure flexibility and modularity. The framework supports multiple LLM providers: OpenAI, Google, Anthropic, xAI, DeepSeek, Qwen (Alibaba DashScope, international and China endpoints), GLM (Zhipu), MiniMax (global + China), OpenRouter, Ollama for local models, and Azure OpenAI for enterprise.
To use TradingAgents inside your code, you can import the tradingagents module and initialize a TradingAgentsGraph() object. The .propagate() function will return a decision. You can run main.py, here's also a quick example:
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)You can also adjust the default configuration to set your own choice of LLMs, debate rounds, etc.
…See tradingagents/default_config.py for all configuration options.
TradingAgents persists two kinds of state across runs.
The decision log is always on. Each completed run appends its decision to ~/.tradingagents/memory/trading_memory.md. On the next run for the same ticker, TradingAgents fetches the realised return (raw and alpha vs SPY), generates a one-paragraph reflection, and injects the most recent same-ticker decisions plus recent cross-ticker lessons into the Portfolio Manager prompt, so each analysis carries forward what worked and what didn't.
Override the path with TRADINGAGENTS_MEMORY_LOG_PATH.
Checkpoint resume is opt-in via --checkpoint. When enabled, LangGraph saves state after each node so a crashed or interrupted run resumes from the last successful step instead of starting over. On a resume run you will see Resuming from step N for <TICKER> on <date> in the logs; on a new run you will see Starting fresh. Checkpoints are cleared automatically on successful completion.
Per-ticker SQLite databases live at ~/.tradingagents/cache/checkpoints/<TICKER>.db (override the base with TRADINGAGENTS_CACHE_DIR). Use --clear-checkpoints to reset all of them before a run.
tradingagents analyze --checkpoint # enable for this run
tradingagents analyze --clear-checkpoints # reset before runningconfig = DEFAULT_CONFIG.copy()
config["checkpoint_enabled"] = True
ta = TradingAgentsGraph(config=config)
_, decision = ta.propagate("NVDA", "2026-01-15")TradingAgents is LLM-driven, so two runs of the same ticker and date can differ. This is expected for a research tool built on language models, not a defect. The variation comes from a few distinct sources, and it helps to separate them.
Language model sampling is non-deterministic. Even at a fixed temperature, providers do not guarantee byte-identical output across calls, and reasoning models (the default GPT-5.x family, and any thinking-mode model) vary the most because their internal reasoning is itself sampled.
Live data moves. News, StockTwits, and Reddit return different content as time passes, so a run today sees different inputs than a run last week even for the same historical trade date. Pin the analysis date to hold the price and indicator window fixed, but the social and news sources still reflect "now".
To reduce variation you can lower the sampling temperature. Set temperature in your config (or TRADINGAGENTS_TEMPERATURE in .env); lower values make models that honor it more repeatable. The current curated models are reasoning-first and largely ignore temperature, so for tighter reproducibility use a non-reasoning model, which you can set explicitly via the Custom model ID option.
config = DEFAULT_CONFIG.copy()
config["llm_provider"] = "openai"
config["temperature"] = 0.0
# Reasoning models ignore temperature. For tighter reproducibility, set a
# non-reasoning deep/quick model explicitly (e.g. via the Custom model ID option).What does not va
Decision-memory settlement only visits the current ticker
Support different LLM providers/models per agent for true multi-model debate
Yahoo rate limiting blocks all market data from data-center / non-US networks; propose a keyless akshare (Sina) vendor
An analyst whose model keeps calling tools ends the run with GraphRecursionError
Optional self-contained HTML export for saved reports
[Bug] Duplicate backtest input reruns the same cell within one sweep
Temporal Knowledge Leakage in LLM Backtesting (Model-Level Future Information Contamination)
Structured output falls back to free text ~1x per run on DeepSeek thinking models
Historical runs have no valuation since #1300: market cap and multiples as of the run date, from SEC EDGAR
Add maxTokenBudget with automatic abort