AI Architecture
Architecture Blueprint
FlowDeck uses two complementary AI systems: the TradingAgents Graph for deep stock analysis and the Briefing Agent for personalized daily portfolio briefs.
Briefing Agent
User Daily Brief Pipeline
The Briefing Agent generates personalized daily (or weekly/custom) portfolio briefs by combining algorithmic context building with specialized LLM agents. It analyzes your subscribed stocks, identifies priority tickers based on attention scores, and produces a concise narrative with market context and actionable insights.
Pipeline Stages
1
Context Builder
AlgorithmicAlgorithmic stage that loads portfolio, fetches market data, ranks tickers by attention score, and builds comprehensive context.
Inputs
- •user_id
- •digest_date
- •portfolio_tickers
- •span_type (daily/weekly/custom)
Outputs
- •DigestContext with quotes, returns, news, fundamentals, platform reports, market movers, sector/peer data
2
Focus Selector Agent
LLM AgentLLM agent that determines which tickers to focus on based on attention scores, user preferences, and portfolio context.
Inputs
- •portfolio_tickers
- •attention_scores
- •user_note
- •user_focus_tickers
Outputs
- •focus_tickers (ordered list of priority tickers)
3
Ticker Interpreter Agent
LLM AgentLLM agent that analyzes each priority ticker to explain what happened, identify the main driver, and compare to platform thesis.
Inputs
- •ticker
- •quote
- •returns
- •news
- •fundamentals
- •platform_reports
- •sector/peer context
Outputs
- •TickerInterpretation (explanation, driver classification, thesis comparison)
4
Market Interpreter Agent
LLM AgentLLM agent that synthesizes market-wide context and explains relevance to the portfolio.
Inputs
- •market_movers
- •global_news
- •ticker_interpretations
- •portfolio_tickers
Outputs
- •MarketInterpretation (market summary, portfolio relevance)
5
Narrative Writer Agent
LLM AgentLLM agent that composes the final brief narrative with market highlights, key signals, what to watch, and risks/opportunities.
Inputs
- •ticker_interpretations
- •market_interpretation
- •user_note
- •narrative_style
- •resources
Outputs
- •narrative (structured or basic format)
- •what_to_watch
- •references
Key Features
- ✓Attention Scoring: Ranks tickers by absolute returns, abnormal moves, and recent news
- ✓Multi-Span Support: Daily, weekly, or custom date ranges
- ✓User Preferences: Optional user notes, focus tickers, and narrative style
- ✓Platform Integration: References FlowDeck reports and provides shareable URLs
- ✓Structured References: Tracks and cites news articles, feeds, and web sources
TradingAgents Graph
Deep Stock Analysis Pipeline
The TradingAgents Graph performs comprehensive stock analysis through a multi-phase debate system. Specialized analysts gather evidence, bull/bear researchers debate investment merits, and risk analysts evaluate tradeoffs before producing final recommendations.
Runtime default analyst selection: market → news → fundamentals → technical → sec (US only). Social analyst is available but not selected by default.
Schematic Workflow
Graph order from `GraphSetup.setup_graph` and `ConditionalLogic`.
Phase 1: Analyst Pipeline
Input State
ticker + trade_date + empty reports
→Market Analyst
score + report
→News & Sentiment Analyst
score + report
→Fundamentals Analyst
score + report
→Technical Analyst
score + report
→Each analyst loops with its `tools_*` node until no more tool calls, then graph clears messages and moves forward.
Phase 2: Investment Debate + Plan
Bull Researcher
writes bull argument
→Bear Researcher
writes bear argument
→Neutral Researcher
writes balanced argument
→Debate Loop
3 * max_debate_rounds
→Research Manager
investment plan + BUY/SELL/HOLD + score + returns
→Agent-by-Agent Contracts
Exact state contracts for each analyst, researcher, manager, and trader.
Phase 1: Analyst Pipeline
Specialized analysts gather market, news & sentiment, fundamentals, technical, and SEC/regulatory evidence.
Market Analyst
Analyst · default: Yes
Consumes
trade_date, company_of_interest, messages
Tools
get_ticker_data, get_ticker_quote, get_indicators
Emits
messages, market_report, market_score
Output shape
{
"messages": [
{
"type": "AIMessage",
"content": "<market_report>"
}
],
"market_report": "<string>",
"market_score": "<int 1-5 | null>"
}News & Sentiment Analyst
Analyst · default: Yes
Consumes
trade_date, company_of_interest, messages
Tools
get_ticker_quote, get_events, get_news, get_global_news, get_insider_transactions, get_reddit_company_social, get_polymarket_sentiment
Emits
messages, sentiment_report, sentiment_score
Output shape
{
"messages": [
{
"type": "AIMessage",
"content": "<sentiment_report>"
}
],
"sentiment_report": "<string>",
"sentiment_score": "<int 1-5 | null>"
}Fundamentals Analyst
Analyst · default: Yes
Consumes
trade_date, company_of_interest, messages
Tools
get_fundamentals, get_balance_sheet, get_cashflow, get_income_statement
Emits
messages, fundamentals_report, fundamentals_score
Output shape
{
"messages": [
{
"type": "AIMessage",
"content": "<fundamentals_report>"
}
],
"fundamentals_report": "<string>",
"fundamentals_score": "<int 1-5 | null>"
}Technical Analyst
Analyst · default: Yes
Consumes
trade_date, company_of_interest, messages
Tools
get_ticker_data, get_ticker_quote, get_indicators, detect_divergence, detect_regime, detect_support_resistance
Emits
messages, technical_report, technical_score
Output shape
{
"messages": [
{
"type": "AIMessage",
"content": "<technical_report>"
}
],
"technical_report": "<string>",
"technical_score": "<int 1-5 | null>"
}SEC Analyst
Analyst · default: Yes (US companies)
Consumes
trade_date, company_of_interest, messages
Tools
get_edgar_filing_content
Emits
messages, sec_report, sec_score
Output shape
{
"messages": [
{
"type": "AIMessage",
"content": "<sec_report>"
}
],
"sec_report": "<string>",
"sec_score": "<int 1-5 | null>"
}Phase 2: Bull/Bear/Neutral Debate + Plan
Bull, bear, and neutral researchers debate in round-robin, then the research manager weighs all three sides and emits the investment plan with the authoritative BUY/SELL/HOLD recommendation. The trader then turns it into an executable plan (TPS).
Bull Researcher
Researcher · default: Always
Consumes
market_report, sentiment_report, fundamentals_report, technical_report, investment_debate_state
Emits
investment_debate_state
Output shape
{
"investment_debate_state": {
"history": "<string>",
"bull_history": "<string>",
"bear_history": "<string>",
"neutral_history": "<string>",
"latest_speaker": "Bull",
"current_response": "Bull Analyst: <string>",
"count": "<int>"
}
}Bear Researcher
Researcher · default: Always
Consumes
market_report, sentiment_report, fundamentals_report, technical_report, investment_debate_state
Emits
investment_debate_state
Output shape
{
"investment_debate_state": {
"history": "<string>",
"bull_history": "<string>",
"bear_history": "<string>",
"neutral_history": "<string>",
"latest_speaker": "Bear",
"current_response": "Bear Analyst: <string>",
"count": "<int>"
}
}Neutral Researcher
Researcher · default: Always
Consumes
market_report, sentiment_report, fundamentals_report, technical_report, investment_debate_state
Emits
investment_debate_state
Output shape
{
"investment_debate_state": {
"history": "<string>",
"bull_history": "<string>",
"bear_history": "<string>",
"neutral_history": "<string>",
"latest_speaker": "Neutral",
"current_response": "Neutral Analyst: <string>",
"count": "<int>"
}
}Research Manager
Manager · default: Always
Consumes
investment_debate_state, market_report, sentiment_report, fundamentals_report, sec_report, technical_report
Emits
investment_debate_state, investment_plan, recommendation, recommendation_score, bull_summary, bear_summary, neutral_summary, expected_return_pct, bear_case_return_pct, bull_case_return_pct
Output shape
{
"investment_debate_state": {
"judge_decision": "<string>",
"history": "<string>",
"bear_history": "<string>",
"bull_history": "<string>",
"neutral_history": "<string>",
"latest_speaker": "<string>",
"current_response": "<string>",
"count": "<int>"
},
"investment_plan": "<string>",
"recommendation": "BUY | SELL | HOLD",
"recommendation_score": "<int 1-5 | null>",
"bull_summary": [
"<string>"
],
"bear_summary": [
"<string>"
],
"neutral_summary": [
"<string>"
],
"expected_return_pct": "<number | null>",
"bear_case_return_pct": "<number | null>",
"bull_case_return_pct": "<number | null>"
}Trader
Trader · default: Always
Consumes
company_of_interest, investment_plan, market_report, sentiment_report, fundamentals_report
Emits
messages, trader_investment_plan, trader_recommendation, trader_tps_plan, trader_key_takeaways, sender
Output shape
{
"messages": [
{
"type": "AIMessage",
"content": "<trader_investment_plan>"
}
],
"trader_investment_plan": "<string>",
"trader_recommendation": "BUY | SELL | HOLD | null",
"trader_tps_plan": "<TPS JSON string>",
"trader_key_takeaways": [
"<string>"
],
"sender": "Trader"
}Final Logged Run Output
Final output structure persisted by `TradingAgentsGraph._log_state(...)`.
{
"company_of_interest": "<string>",
"trade_date": "<YYYY-MM-DD>",
"market_report": "<string>",
"market_score": "<int | null>",
"sentiment_report": "<string>",
"sentiment_score": "<int | null>",
"fundamentals_report": "<string>",
"fundamentals_score": "<int | null>",
"sec_report": "<string>",
"sec_score": "<int | null>",
"technical_report": "<string>",
"technical_score": "<int | null>",
"investment_debate_state": {
"bull_history": "<string>",
"bear_history": "<string>",
"neutral_history": "<string>",
"history": "<string>",
"current_response": "<string>",
"judge_decision": "<string>"
},
"trader_investment_decision": "<string>",
"trader_tps_plan": "<TPS JSON string>",
"investment_plan": "<string>",
"recommendation": "BUY | SELL | HOLD",
"recommendation_score": "<int | null>",
"expected_return_pct": "<number | null>",
"bear_case_return_pct": "<number | null>",
"bull_case_return_pct": "<number | null>"
}