Multi-Agent Trading System - Agent Descriptions
This document provides detailed descriptions of all agents in the multi-agent trading system, their roles, responsibilities, and how they collaborate.
System Overview
The multi-agent system operates in three distinct phases with specialized teams:
- Analysis Phase: Four analysts independently examine different aspects
- Research Phase: Bull and Bear researchers debate, managed by Research Manager
- Execution Phase: Trader proposes, Risk Team debates sizing, Portfolio Manager decides
``` ┌─────────────────────────────────────────────────────────────────┐ │ ANALYSIS PHASE │ │ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ ┌─────────┐│ │ │ Market │ │ Sentiment │ │ News │ │ Funds ││ │ │ Analyst │ │ Analyst │ │ Analyst │ │ Analyst ││ │ └──────┬───────┘ └──────┬───────┘ └──────┬───────┘ └────┬────┘│ │ │ │ │ │ │ │ └────────────────┴────────────────┴───────────────┘ │ │ │ │ └──────────────────────────────┼──────────────────────────────────┘ ▼ ┌─────────────────────────────────────────────────────────────────┐ │ RESEARCH PHASE │ │ ┌──────────────┐ ┌──────────────┐ ┌──────────────────────────┐│ │ │ Bull │ │ Bear │ │ Research Manager ││ │ │ Researcher │ │ Researcher │ │ (Synthesizes Debate) ││ │ └──────┬───────┘ └──────┬───────┘ └──────────┬───────────────┘│ │ │ │ │ │ │ └────────────────┴─────────────────────┘ │ │ │ │ └──────────────────────────────┼──────────────────────────────────┘ ▼ ┌─────────────────────────────────────────────────────────────────┐ │ EXECUTION PHASE │ │ ┌──────────────┐ ┌────────────────────────┐ ┌────────────────┐│ │ │ Trader │ │ Risk Team │ │ Portfolio ││ │ │ (Proposes) │ │ (Debates Sizing) │ │ Manager ││ │ └──────┬───────┘ └────────┬───────────────┘ └────────┬───────┘│ │ │ │ │ │ │ └──────────────────┴──────────────────────────┘ │ │ │ │ │ FINAL DECISION: BUY/SELL/HOLD │ └─────────────────────────────────────────────────────────────────┘ ```
Analysis Team
1. Market Analyst 🔷
Role: Technical Analysis and Liquidity Assessment
Responsibilities:
- Analyze price trends and technical indicators
- Evaluate trading volume and liquidity
- Assess chart patterns and support/resistance levels
- Calculate volatility metrics (ATR, Bollinger Bands)
- Determine market momentum indicators (RSI, MACD, Moving Averages)
- Evaluate bid-ask spreads and market depth
Key Metrics Analyzed:
- Price action (trends, breakouts, reversals)
- Volume analysis (accumulation/distribution)
- Technical indicators (20/50/200-day MAs, RSI, MACD)
- Support and resistance levels
- Volatility measures (ATR, standard deviation)
- Liquidity metrics (average daily volume, spread)
Output Format: ``` MARKET ANALYSIS
- Current Price: $XXX
- Trend: Bullish/Bearish/Neutral
- Key Levels: Support at $X, Resistance at $Y
- Volume: Above/Below average
- Liquidity: High/Medium/Low
- Technical Signal: BUY/SELL/HOLD with confidence ```
Data Sources:
- Yahoo Finance (price, volume, historical data)
- EODHD (advanced technical indicators)
- Real-time quote data
2. Sentiment Analyst 💭
Role: Social Media Sentiment and Discovery Status
Responsibilities:
- Monitor social media platforms (Twitter, StockTwits, Reddit)
- Gauge retail investor sentiment
- Identify trending discussions and mentions
- Assess "undiscovered" opportunity status
- Evaluate social momentum and virality
- Track influencer opinions and positioning
Key Metrics Analyzed:
- Social media mention volume
- Sentiment polarity (positive/negative/neutral)
- StockTwits message counts and sentiment scores
- Reddit r/wallstreetbets activity
- Twitter/X financial influencer discussions
- Search trend momentum (Google Trends)
- Discovery score (institutional vs retail attention)
Output Format: ``` SENTIMENT ANALYSIS
- Overall Sentiment: Bullish/Bearish/Mixed
- Social Volume: High/Medium/Low
- Undiscovered Status: Undiscovered/Emerging/Well-Known
- Key Themes: [List of discussion topics]
- Influencer Sentiment: Positive/Negative/Neutral
- Momentum: Increasing/Stable/Declining ```
Data Sources:
- StockTwits API
- Twitter/X API (via Tavily search)
- Reddit data
- Social sentiment aggregators
3. News Analyst 📰
Role: Recent Events, Catalysts, and Jurisdiction Analysis
Responsibilities:
- Monitor recent news and press releases
- Identify upcoming catalysts (earnings, product launches, etc.)
- Assess geopolitical and regulatory risks
- Evaluate jurisdiction-specific concerns
- Track competitor news and industry trends
- Analyze management changes and corporate actions
Key Areas Analyzed:
- Recent news (past 7-30 days)
- Upcoming catalysts (earnings dates, product launches)
- Regulatory filings and SEC documents
- Geopolitical risks by jurisdiction
- Industry trends and competitive landscape
- Management commentary and guidance
- Analyst upgrades/downgrades
Output Format: ``` NEWS ANALYSIS
- Recent Headlines: [Key stories]
- Upcoming Catalysts: [Events with dates]
- Jurisdiction Risks: [Country-specific concerns]
- Regulatory Status: Clear/Under Review/Problematic
- Industry Trends: [Sector dynamics]
- Sentiment: Positive/Negative/Neutral ```
Data Sources:
- Tavily news search
- Finnhub news API
- SEC EDGAR filings
- Financial news aggregators
4. Fundamentals Analyst 📊
Role: Financial Scoring and Valuation
Responsibilities:
- Analyze financial statements (10-K, 10-Q)
- Calculate valuation metrics (P/E, P/B, P/S, EV/EBITDA)
- Assess profitability (margins, ROE, ROA)
- Evaluate growth rates (revenue, earnings)
- Score financial health (debt ratios, current ratio)
- Compare against industry peers
- Generate comprehensive DATA_BLOCK
Key Metrics Analyzed:
- Valuation: P/E, P/B, P/S, EV/EBITDA, PEG ratio
- Profitability: Gross margin, operating margin, net margin, ROE, ROA
- Growth: Revenue growth, earnings growth, EPS growth
- Financial Health: Debt-to-equity, current ratio, quick ratio, interest coverage
- Cash Flow: Operating cash flow, free cash flow
- Efficiency: Asset turnover, inventory turnover
- Dividend: Yield, payout ratio, dividend growth
Output Format: ``` FUNDAMENTALS ANALYSIS - DATA_BLOCK
VALUATION:
- P/E Ratio: XX.X (Industry avg: YY.Y)
- P/B Ratio: X.X
- P/S Ratio: X.X
- EV/EBITDA: XX.X
PROFITABILITY:
- Gross Margin: XX%
- Operating Margin: XX%
- Net Margin: XX%
- ROE: XX%
GROWTH:
- Revenue Growth (YoY): XX%
- EPS Growth (YoY): XX%
FINANCIAL HEALTH:
- Debt/Equity: X.X
- Current Ratio: X.X
- Interest Coverage: XX.X
SCORE: X/10 (Value-to-Growth fit) ```
Data Sources:
- Yahoo Finance financials
- SEC EDGAR (10-K, 10-Q filings)
- Finnhub fundamental data
- EODHD fundamental data
Research Team
5. Bull Researcher 🐂
Role: Advocate for BUY Opportunities
Responsibilities:
- Build strongest possible case for buying
- Identify growth opportunities and catalysts
- Highlight competitive advantages and moats
- Emphasize positive trends and momentum
- Challenge bearish arguments
- Synthesize bullish signals from all analyst reports
Debate Strategy:
- Present thesis with supporting evidence
- Counter bear arguments with data
- Emphasize upside potential and asymmetric risk/reward
- Reference analyst findings (market technicals, positive sentiment, etc.)
- Focus on underappreciated growth drivers
Output Format: ``` BULL THESIS
INVESTMENT CASE: [Compelling narrative for why this is a BUY]
KEY CATALYSTS:
- [Specific catalyst with impact]
- [Specific catalyst with impact]
- [Specific catalyst with impact]
COMPETITIVE ADVANTAGES:
- [Moat 1]
- [Moat 2]
- [Moat 3]
UPSIDE POTENTIAL:
- Target Price: $XXX (XX% upside)
- Best Case: $XXX (XX% upside)
REBUTTAL TO BEAR CONCERNS: [Address each bear concern with counter-argument] ```
6. Bear Researcher 🐻
Role: Identify Risks and Thesis Violations
Responsibilities:
- Build strongest possible case against buying
- Identify downside risks and red flags
- Highlight competitive threats and disruption
- Emphasize negative trends and deteriorating fundamentals
- Challenge bullish arguments
- Check for thesis violations (too expensive, too risky, too popular)
Debate Strategy:
- Present counter-thesis with evidence
- Challenge bull assumptions
- Emphasize downside risk and poor risk/reward
- Reference analyst findings (poor technicals, negative sentiment, etc.)
- Focus on overlooked risks
Thesis Violation Checks:
- Too Expensive: P/E > 40, or significantly above sector average
- Too Risky: High debt, negative cash flow, regulatory issues
- Too Popular: Excessive social media hype, crowded trade
- Undiscovered Violation: Stock already well-known and covered
- Liquidity Issues: Low volume, wide spreads
Output Format: ``` BEAR THESIS
RISK ASSESSMENT: [Compelling narrative for why this is risky]
KEY RISKS:
- [Specific risk with impact]
- [Specific risk with impact]
- [Specific risk with impact]
COMPETITIVE THREATS:
- [Threat 1]
- [Threat 2]
- [Threat 3]
DOWNSIDE POTENTIAL:
- Bear Target: $XXX (XX% downside)
- Worst Case: $XXX (XX% downside)
THESIS VIOLATIONS:
- Too Expensive: [Y/N + explanation]
- Too Risky: [Y/N + explanation]
- Too Popular: [Y/N + explanation]
REBUTTAL TO BULL CLAIMS: [Address each bull claim with counter-argument] ```
7. Research Manager 🎯
Role: Synthesize Debate and Enforce Thesis Compliance
Responsibilities:
- Review bull and bear arguments objectively
- Synthesize key insights from both sides
- Identify consensus and disagreement points
- Enforce investment thesis criteria
- Make preliminary recommendation
- Ensure debate quality and evidence-based reasoning
Investment Thesis Criteria: The stock must meet these criteria to be a BUY:
- Value-to-Growth: Good valuation relative to growth potential
- Ex-US: Non-US company or significant international exposure
- Undiscovered: Not overly popular or crowded
- Liquid: Adequate trading volume and tight spreads
- No Critical Red Flags: No dealbreaker risks
Synthesis Process:
- Summarize bull thesis (2-3 key points)
- Summarize bear thesis (2-3 key points)
- Identify areas of agreement
- Weigh evidence strength on both sides
- Check thesis compliance
- Make preliminary recommendation
Output Format: ``` RESEARCH SYNTHESIS
BULL CASE SUMMARY: [2-3 strongest bull arguments]
BEAR CASE SUMMARY: [2-3 strongest bear arguments]
DEBATE ASSESSMENT:
- Points of Agreement: [List]
- Key Disagreements: [List]
- Evidence Quality: [Assessment]
THESIS COMPLIANCE CHECK: ✓/✗ Value-to-Growth fit ✓/✗ Ex-US exposure ✓/✗ Undiscovered status ✓/✗ Adequate liquidity ✓/✗ No critical red flags
PRELIMINARY RECOMMENDATION: BUY/SELL/HOLD CONFIDENCE: High/Medium/Low
RATIONALE: [Balanced explanation of recommendation] ```
Execution Team
8. Trader ⚡
Role: Propose Execution Parameters
Responsibilities:
- Propose entry price and execution strategy
- Recommend order type (market/limit/stop)
- Suggest timing considerations
- Estimate execution costs (slippage, spread)
- Propose initial risk parameters
- Consider market conditions for execution
Execution Considerations:
- Current market conditions (volatility, liquidity)
- Bid-ask spread and depth
- Time of day and session (pre-market, regular, after-hours)
- Recent price action and support/resistance
- Order size relative to average volume
- Urgency vs price improvement tradeoff
Output Format: ``` TRADE PROPOSAL
EXECUTION PLAN:
- Entry Strategy: [Market/Limit/TWAP/VWAP]
- Target Entry Price: $XXX
- Order Type: [Specific order details]
- Execution Timing: [When to execute]
RISK PARAMETERS (Initial):
- Stop Loss: $XXX (X% below entry)
- Take Profit: $XXX (X% above entry)
- Position Size: [To be determined by Risk Team]
EXECUTION COSTS:
- Expected Slippage: X%
- Bid-Ask Spread: $X.XX
- Commission: $X.XX
MARKET CONDITIONS:
- Current Volatility: High/Medium/Low
- Liquidity Assessment: Sufficient/Limited
- Optimal Timing: [Recommendation] ```
9. Risk Team (Risky, Safe, Neutral) ⚖️
Role: Debate Position Sizing
Composition: Three risk managers with different philosophies:
9a. Risky Risk Manager 🎲
- Advocates for larger position sizes
- Emphasizes high conviction and asymmetric upside
- Willing to accept higher volatility for higher returns
- Typical recommendation: 8-15% of portfolio
9b. Safe Risk Manager 🛡️
- Advocates for smaller, conservative positions
- Emphasizes capital preservation and downside protection
- Prefers diversification and lower concentration
- Typical recommendation: 2-5% of portfolio
9c. Neutral Risk Manager ⚖️
- Mediates between risky and safe perspectives
- Balances risk/reward based on setup quality
- Adjusts sizing based on confidence level
- Typical recommendation: 4-8% of portfolio
Debate Process:
- Each risk manager presents sizing recommendation
- Risky makes case for larger size
- Safe makes case for smaller size
- Neutral proposes balanced approach
- All three debate and justify positions
- Consensus emerges or Portfolio Manager decides
Risk Sizing Factors:
- Conviction level (from research synthesis)
- Volatility and beta
- Correlation with existing portfolio
- Thesis clarity and evidence strength
- Downside risk magnitude
- Liquidity constraints
- Account size and diversification
Output Format: ``` RISK TEAM DEBATE
RISKY MANAGER:
- Recommended Size: XX% of portfolio
- Rationale: [Aggressive case]
- Max Loss Tolerance: $XXX (X% of portfolio)
SAFE MANAGER:
- Recommended Size: X% of portfolio
- Rationale: [Conservative case]
- Max Loss Tolerance: $XX (X% of portfolio)
NEUTRAL MANAGER:
- Recommended Size: X% of portfolio
- Rationale: [Balanced case]
- Max Loss Tolerance: $XXX (X% of portfolio)
CONSENSUS RECOMMENDATION: X-X% of portfolio POSITION SIZE: X shares at $XXX = $XX,XXX total MAX LOSS: $X,XXX (X% of portfolio) ```
10. Portfolio Manager 👔
Role: Final Authority on All Trading Decisions
Responsibilities:
- Review all analyses, debates, and recommendations
- Make final BUY/SELL/HOLD decision
- Approve position sizing and risk parameters
- Ensure portfolio-level risk management
- Authorize trade execution
- Document decision rationale
Decision-Making Framework:
- Review analysis phase findings
- Evaluate research debate synthesis
- Assess trader's execution proposal
- Consider risk team's sizing debate
- Apply portfolio-level constraints
- Make final decision with clear rationale
Portfolio-Level Considerations:
- Current portfolio composition
- Sector and geography diversification
- Total risk exposure and concentration limits
- Cash reserves and buying power
- Correlation with existing positions
- Overall portfolio strategy alignment
Final Decision Criteria:
- Does this meet investment thesis requirements?
- Is the risk/reward compelling?
- Does sizing match conviction level?
- Are there any dealbreaker red flags?
- How does this fit the portfolio?
Output Format: ``` FINAL TRADE DECISION
DECISION: BUY / SELL / HOLD
POSITION DETAILS:
- Ticker: $XXX
- Entry Price: $XXX
- Position Size: XXX shares ($XX,XXX total)
- Portfolio Allocation: X.X%
- Stop Loss: $XXX (X% risk)
- Take Profit: $XXX (X% target)
RATIONALE: [Clear, comprehensive explanation of why this decision was made, referencing key points from analysts, researchers, trader, and risk team. Address both bull and bear cases.]
KEY FACTORS:
- [Most important consideration]
- [Second most important consideration]
- [Third most important consideration]
RISK ASSESSMENT:
- Primary Risk: [Biggest concern]
- Risk Mitigation: [How it's addressed]
- Max Acceptable Loss: $XXX (X% of portfolio)
CONVICTION LEVEL: High / Medium / Low
EXECUTION AUTHORIZATION: [Approved for immediate execution / Execute on X conditions / Do not execute]
Portfolio Manager: [Name] Date: [Timestamp] ```
Agent Interaction Flow
Full Analysis Workflow
```
-
USER INPUT └─> Ticker symbol (e.g., AAPL)
-
PARALLEL ANALYSIS (All analysts work simultaneously) ├─> Market Analyst → Technical report ├─> Sentiment Analyst → Sentiment report ├─> News Analyst → News report └─> Fundamentals Analyst → DATA_BLOCK
-
FINANCIAL VALIDATION └─> Check for red flags → Route to appropriate path
-
RESEARCH DEBATE ├─> Bull Researcher → Bull thesis ├─> Bear Researcher → Bear thesis └─> Research Manager → Synthesis and preliminary recommendation
-
OPTIONAL CROSS-VALIDATION └─> Consultant (OpenAI) → Independent second opinion
-
TRADE PROPOSAL └─> Trader → Execution plan and initial risk parameters
-
RISK SIZING DEBATE ├─> Risky Risk Manager → Aggressive sizing ├─> Safe Risk Manager → Conservative sizing ├─> Neutral Risk Manager → Balanced sizing └─> Consensus or debate
-
FINAL DECISION └─> Portfolio Manager → FINAL DECISION: BUY/SELL/HOLD
-
OUTPUT └─> Complete analysis report with decision and rationale ```
Communication Protocol
Between Analysts:
- No direct communication
- Work independently to avoid bias
- Results aggregated by Research Manager
Research Team:
- Bull and Bear engage in structured debate
- Research Manager moderates and synthesizes
- Must provide evidence-based arguments
Execution Team:
- Trader proposes, doesn't decide
- Risk Team debates sizing only (not decision itself)
- Portfolio Manager has final authority
Information Flow:
- Analysts → Research Team (one-way)
- Research Team → Execution Team (one-way)
- Portfolio Manager sees all (full visibility)
Prompt Engineering
Each agent has a carefully crafted system prompt that defines:
- Role and Expertise: What the agent specializes in
- Responsibilities: Specific tasks to perform
- Output Format: Structured format for responses
- Constraints: What to avoid or emphasize
- Tools Available: Which data sources they can access
- Collaboration Protocol: How to interact with other agents
Example: Market Analyst Prompt Structure
``` You are the Market Analyst in a multi-agent trading system.
ROLE: You specialize in technical analysis and liquidity assessment.
RESPONSIBILITIES:
- Analyze price trends using moving averages, RSI, MACD
- Evaluate trading volume and market depth
- [... detailed list ...]
OUTPUT FORMAT: Provide a structured analysis with these sections:
- Current Price & Trend
- Technical Indicators
- Volume Analysis
- Support & Resistance Levels
- Liquidity Assessment
- Signal: BUY/SELL/HOLD with confidence level
CONSTRAINTS:
- Use only factual, data-driven analysis
- Do not make final trading decisions
- Focus on technical aspects only (no fundamentals)
TOOLS: You have access to:
- Yahoo Finance API for quotes and historical data
- Technical indicator calculations
- Volume and liquidity metrics ```
Performance Optimization
LLM Selection
Quick Mode (Gemini 2.0 Flash):
- Faster analysis (5-15 seconds total)
- Lower cost (~$0.002-0.005 per analysis)
- Suitable for initial screening
- Less detailed reasoning
Deep Mode (Gemini 3.0 Pro):
- Thorough analysis (30-60 seconds total)
- Higher cost (~$0.01-0.02 per analysis)
- Better for final decisions
- Extended thinking capabilities
Parallel Execution
Analysts run in parallel to minimize latency: ``` Sequential: 4 agents × 10s = 40s Parallel: max(10s, 10s, 10s, 10s) = 10s ```
Caching and Memory
- Vector memory (ChromaDB) stores past analyses
- Reduces redundant LLM calls for recently analyzed tickers
- Embedding-based retrieval of similar situations
Quality Assurance
Output Validation
Each agent output is validated for:
- Format compliance
- Required fields present
- Data consistency
- Logical coherence
Debate Quality
Research Manager ensures:
- Both bull and bear provide evidence
- Arguments address each other
- No circular reasoning
- Facts are verifiable
Decision Traceability
Every decision includes:
- Complete audit trail
- All agent outputs preserved
- Decision rationale documented
- Timestamp and version info
Future Enhancements
Planned Agent Additions
- Macro Analyst: Global economic and sector trends
- Options Analyst: Implied volatility and options flow
- Insider Activity Analyst: Executive trades and ownership
- Short Interest Analyst: Borrow rates and squeeze potential
Planned Features
- Multi-ticker comparison: Compare multiple stocks simultaneously
- Portfolio rebalancing: Suggest adjustments to existing portfolio
- Event-driven triggers: Auto-analyze on earnings, FDA approvals, etc.
- Backtesting mode: Test agent decisions on historical data
For implementation status, see COMPLETION_SUMMARY.md For integration details, see INTEGRATION.md