TradingAgents-CN: A Deep Migration Plan from LangGraph to Agno
This is a structured English summary of a long Chinese technical planning document.
1. Background
TradingAgents-CN is a multi-agent financial trading decision framework:
- Stack: LangGraph 0.4.8 + LangChain + FastAPI (+ MongoDB/motor, Redis)
- Agents: 11 core agents — 4 analysts (Market, SocialMedia, News, Fundamentals), 2 researchers (Bull, Bear), 1 Trader, 4 risk roles (Risky/Safe/Neutral debators, RiskManager)
- Data: multi-source integration for China A-shares, HK stocks, US stocks (akshare, tushare, yfinance, finnhub, eodhd, baostock)
- LLM providers: OpenAI, Anthropic, DeepSeek, Google, DashScope (Ali Bailian), etc., via a factory pattern
- Deployment: full Web app + CLI + API service
TradingAgentsWorkflow(Workflow)with anAnalysisStageenum; analysts run in parallel, researchers sequentially, risk debators in parallel, trader last- Declarative
TradingState,DebateState,RiskDebateStateclasses with optional report fields and debate stages - Decorator-based
@Tooldefinitions for stock data, technical indicators, news, valuation - An
AgnoLLMFactoryproducing provider-specific LLM instances from environment API keys - Functional parity: agent output quality >= 95% of original; all 7 workflow stages complete; all 6 data sources functional (quality score >= 0.8)
- API compatibility: all existing endpoints (
/api/analyze/{symbol},/api/batch_analyze, etc.) return unchanged formats - Performance: 100-agent creation >= 100x faster; per-stock analysis <= 30s and >= 50% faster; memory increase <= 500MB and >= 80% lower than original; 10-way concurrency works
- Quality: >= 90% unit, 85% integration, 80% E2E test coverage
- Team: 12–14 people (PM, architect, 2 Agno developers, 2 integration engineers, 2 QA, ops, product, QA governance, 1–2 backup)
- Budget: ~$640,000 total ($510k labor, $75k technical, $55k other)
- ROI: estimated $450k/year savings; payback in ~17 months
Current graph workflow uses StateGraph with a shared AgentState (extending MessagesState) and typed sub-states like InvestDebateState (bull/bear history, judge decision).
2. Migration Motivation
1. Performance: Agno claims agent creation ~10,000x faster and ~1/50 the memory usage vs LangGraph 2. Architecture: decentralized execution engine, zero-copy data pipeline 3. Developer efficiency: declarative, modular agent definitions 4. Multimodal support and alignment with agent-framework trends
Goals: 1000–10000x agent creation speedup, 90–95% memory reduction, full functional parity, backward-compatible APIs.
3. LangGraph vs Agno (author's assessment)
| Dimension | LangGraph | Agno | |---|---|---| | Agent creation speed | baseline | claimed 10,000x | | Memory usage | baseline | claimed 1/50 | | Learning curve | moderate | simpler | | Ecosystem | mature | emerging | | Feature completeness | complete | unverified |
Notably, the author flags Agno's maturity, API compatibility, and documentation as high risks; the Agno architecture samples in the document are explicitly speculative.
4. Recommended Strategy and Target Architecture
Three strategies were compared: progressive migration (recommended), full rewrite, and dual-track running. The recommended target architecture includes:
5. Phased Plan (~12–18 weeks, 6 stages)
1. Base infrastructure (2–3 wks): Agno setup, state system, LLM adapter layer, minimal agent template
2. Core agents (3–4 wks): migrate 4 analysts + 2 researchers, tool system, prompt templates
3. Workflow orchestration (2–3 wks): workflow engine, agent messaging, parallel/async coordination, state propagation and rollback
4. Advanced features (2–3 wks): memory system (FinancialSituationMemory + vector DB), risk management, agent pooling, monitoring
5. Integration & testing (2–3 wks): FastAPI/frontend/data compatibility, functional, performance, stress, and regression tests
6. Deployment (1–2 wks): blue-green rollout, monitoring, rollback plan, user docs
Key milestones at weeks 3, 7, 10, 13, and 18.
6. Acceptance Criteria
7. Risks and Mitigations
High-priority risks: Agno framework immaturity, missing API compatibility, insufficient test coverage. Mitigations include PoC validation, adapter layers, keeping the LangGraph version in parallel, blue-green deployment, and rollback triggers (e.g., abort migration if core features are unachievable or performance is >50% below expectations).