
Deploy TradingAgents: Self-Hosted Multi-Agent AI Stock Analysis
Run LLM analyst, researcher and risk agents on any stock ticker.
TradingAgents
Just deployed
/data
Deploy and Host TradingAgents on Railway

TradingAgents is an open source multi-agent LLM framework for stock analysis from Tauric Research. It models a small trading firm: analyst agents study fundamentals, news, sentiment and technical indicators; bullish and bearish researchers debate the findings; a trader drafts a plan; and a risk team and portfolio manager settle on a final rating such as Buy, Hold or Sell, with every report kept. It works with OpenAI, Anthropic Claude, Google Gemini, xAI Grok, DeepSeek, OpenRouter and any OpenAI-compatible endpoint, and pulls market data from Yahoo Finance or Alpha Vantage. The framework is Apache-2.0 licensed with about 122,000 GitHub stars, and v0.7.1 shipped in October 2026. This template wraps it in a small FastAPI server with a web form, live logs and downloadable reports, plus a volume for results, cache and agent memory. Hosting costs about $5/month on Railway plus the LLM tokens each run uses. It is a research tool, not financial advice.
What This Template Deploys
| Service | Purpose |
|---|---|
| TradingAgents | Python 3.12 image built from a Railway wrapper that installs TradingAgents from upstream main. FastAPI server and web UI on port 8000 with a public domain. Health check on /health. |
| Persistent Volume | Mounted at /data. Holds decision logs and full JSON reports in /data/logs, the market data cache in /data/cache, the agents' memory file in /data/memory, and the job list, so history survives redeploys. |
Important: The Web UI Has No Login
Read this before adding any keys. The wrapper's web page and API are public and have no password. Anyone who finds your Railway URL can start analyses, see past jobs and read their reports.
If you set a provider key such as OPENAI_API_KEY as a variable, any visitor can run analyses on your account. A visitor can also send a custom base URL with a request, which makes the server send that key to a server they control.
The safe way to run it: leave every provider key variable empty and paste your key into the form's API key field for each run. That key is held in memory only while that run is going and is not written to disk. Keep the domain private, and remove the public domain in Settings when you are not using it. For a shared or long-running setup, put an authenticating proxy in front of the service.
About Hosting TradingAgents
A single chatbot prompt about a stock gives you one opinion. TradingAgents splits the job into roles and makes them argue, which surfaces risks a single answer often skips.
Analyst team. The fundamentals analyst reads financial statements and filings, the sentiment analyst gauges social and news mood, the news analyst follows company and macro events, and the market analyst computes indicators such as MACD, RSI and moving averages. You choose which analysts run.
Researcher debate. A bull and a bear researcher argue over the analyst reports for as many rounds as you set, and a research manager writes the investment plan.
Trader and risk team. The trader turns the plan into a proposal. Aggressive, neutral and conservative risk analysts debate it, and the portfolio manager makes the final call.
Two model tiers. A deep-thinking model handles the debates and final decisions, while a cheaper quick model handles data gathering, so you can balance quality and cost.
Memory. The agents keep a decision log on the volume and can learn from how earlier calls played out.
Full reports. Every run stores each agent's report and both debates. The web UI shows them when the job finishes, and you can download the whole run as JSON.
Deploy TradingAgents in Under 5 Minutes
- Click Deploy on Railway. Leave the provider key variables empty for now; see the warning above.
- Wait for the build and the
/healthcheck. The first build takes a few minutes because it installs TradingAgents and its data libraries. - Open the public domain. Pick a provider, paste your API key, enter a ticker such as
NVDAand an analysis date. - Choose the deep and quick models, the debate rounds and the analysts, then start the run.
- Watch the live log. A run usually takes 3 to 10 minutes, then the rating and full reports appear.
Common Use Cases
- Second opinion on a stock: see bull and bear cases and a risk review before you do your own research.
- Model comparison: run the same ticker and date with different LLMs and compare their reasoning and ratings.
- Research and teaching: show how multi-agent LLM systems debate and reach decisions.
- Historical case studies: pick a past date to see what the agents would have concluded with the data available then.
- Automation: call
POST /api/analyzefrom a script or scheduler and fetch the report from the jobs API.
Configuration
| Variable | Required | Default | Description |
|---|---|---|---|
OPENAI_API_KEY | Optional | empty | OpenAI key. Leave empty on a public URL |
ANTHROPIC_API_KEY | Optional | empty | Anthropic Claude key |
GOOGLE_API_KEY | Optional | empty | Google Gemini key |
XAI_API_KEY | Optional | empty | xAI Grok key |
DEEPSEEK_API_KEY | Optional | empty | DeepSeek key |
OPENROUTER_API_KEY | Optional | empty | OpenRouter key |
ALPHA_VANTAGE_API_KEY | Optional | empty | Routes all market data through Alpha Vantage instead of Yahoo Finance |
TRADINGAGENTS_RESULTS_DIR | Optional | /data/logs | Reports and job history |
TRADINGAGENTS_DATA_CACHE_DIR | Optional | /data/cache | Market data cache |
TRADINGAGENTS_MEMORY_LOG | Optional | /data/memory/trading_memory.md | Agent decision memory |
PORT | Auto-set | 8000 | HTTP port |
Choosing models. The form defaults to gpt-4o and gpt-4o-mini. Type any model your provider offers. Stronger deep-thinking models give better debates but cost more per run.
Other providers. Choose custom with a base URL to use Groq, Mistral, vLLM, LM Studio or any OpenAI-compatible server.
Using the API. POST /api/analyze returns a job ID. Poll GET /api/jobs/ID for status, read GET /api/jobs/ID/logs for progress, and fetch GET /api/jobs/ID/report or /report/download when it completes. The same no-login warning applies to every route.
TradingAgents vs. Alternatives
| Feature | TradingAgents on Railway | AI stock rating services | ChatGPT chat | FinRobot |
|---|---|---|---|---|
| Hosting | Self-hosted | Hosted SaaS | Hosted | Self-hosted, code only |
| License | Apache-2.0 | Proprietary | Proprietary | Apache-2.0 |
| Multi-agent debate | ✅ | ❌ | ❌ | ✅ |
| Choose your LLM | ✅ | ❌ | ❌ | ✅ |
| Full reasoning reports | ✅ | Scores only | One answer | ✅ |
| Web UI | ✅ via wrapper | ✅ | ✅ | ❌ |
| Price | About $5/month plus tokens | Monthly subscription | Subscription | Your compute plus tokens |
Rating services give quick scores without showing their reasoning. A chat assistant gives one answer with no structured debate. FinRobot is a capable open source agent platform but has no ready web app.
Dependencies for TradingAgents Hosting
- A Railway account.
- An API key from at least one LLM provider. Alpha Vantage is optional; Yahoo Finance needs no key.
Deployment Dependencies
- TradingAgents on GitHub: framework source, releases and paper links
- TradingAgents-Railway-Template: the FastAPI wrapper used here
- Alpha Vantage: optional market data API
Implementation Details
The Dockerfile installs TradingAgents from the upstream main branch at build time, so each rebuild picks up the newest code. That brings fixes, but a breaking upstream change can also break a build. Jobs run in the background on one worker; the UI polls for progress and logs. The server keeps the newest 100 jobs. Reports for finished runs are written to the volume.
Frequently Asked Questions
What is TradingAgents? An Apache-2.0 multi-agent LLM framework from Tauric Research that analyzes a stock with analyst, researcher, trader and risk agents.
How much does it cost to run? About $5/month on Railway, plus LLM tokens for each run, which depend on the models and debate rounds you choose.
Is my API key safe? Only if you paste it in the form per run and leave the key variables empty. The UI has no login, so keys stored as variables can be used by anyone with the URL.
Does TradingAgents place real trades? No. It produces a rating and reports. It is a research tool, not financial advice.
Which data sources does it use?
Yahoo Finance by default. Set ALPHA_VANTAGE_API_KEY to route market, fundamentals and news data through Alpha Vantage.
How long does one analysis take? Usually 3 to 10 minutes, depending on the models, analysts and debate rounds.
Why Deploy and Host TradingAgents on Railway?
Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.
By deploying TradingAgents on Railway, you get a multi-agent AI stock research lab with any LLM provider, saved reports and live logs, without installing Python locally.
Template Content
TradingAgents
praveen-ks-2001/TradingAgents-Railway-TemplateOPENAI_API_KEY
OpenAI key (default provider)

