System
Research Workflow
Every research request in Thesis AI follows an eight-step pipeline: from user query to streamed thesis output. Each step is designed to minimize latency, maximize signal quality, and ensure output is grounded in verifiable data.
Pipeline Overview
Step-by-Step
User Submits a Query
The user types a research question or selects a symbol in the mobile app. Common query types include "What's moving NVDA today?", "Give me a macro read", or "How is my portfolio positioned?" The app sends the query along with the user's portfolio and watchlist context to the API.
Context Assembly
The API assembles a full research context: the user's portfolio holdings (symbols, sizes), their watchlist, current portfolio exposure, and any active session notes from prior turns. This context is passed to the Investment Manager so agents receive personalized, not generic, inputs.
Intent Detection & Agent Routing
The Investment Manager analyzes the query for intent signals. Keywords like "rates" or "Fed" route to the Macro Agent. A ticker symbol triggers Price, Fundamentals, and News in parallel. "Holdings" routes to the Portfolio Agent. Ambiguous queries run the full default agent set.
Data Fetching
Each selected agent fetches its required data. The Macro Agent pulls the latest FRED snapshot (Fed rate, CPI, unemployment, yields). The Fundamentals Agent fetches company ratios from Massive API. The News Agent retrieves recent headlines. Price & Trend Agent fetches OHLC bars. Data is cached in Redis to avoid redundant vendor calls.
Parallel Agent Execution
Selected agents run in parallel, each receiving a structured data snapshot and their role-specific prompt. Every agent returns a structured output: a one-sentence summary, a confidence score (0–100), 2–5 signal bullets, and typed data fields. Agents are constrained to the provided data — they cannot invent figures.
Evidence Layer Aggregation
The Investment Manager collects all agent outputs into a unified evidence layer. Signals are ranked by relevance and confidence. Conflicts between agents (e.g., bullish fundamentals vs. bearish macro) are flagged and included in the synthesis context.
Thesis Synthesis
The synthesis engine receives the full evidence layer and produces the final output: a Bull / Bear / Neutral framing, a narrative explanation, a ranked list of catalysts and risks, and an overall confidence score. The output is structured for mobile consumption — scannable, concise, and source-aware.
Streaming Delivery
The response streams to the mobile client via Server-Sent Events (SSE), so users see the thesis building in real time rather than waiting for a complete response. The app renders the thesis card, signals, and confidence score as chunks arrive.
Output Format
The final thesis output follows a consistent structure regardless of which agents ran:
| Field | Description |
|---|---|
| Stance | Bull / Bear / Neutral — the overall directional read |
| Confidence | 0–100 score reflecting data quality and signal agreement across agents |
| Narrative | Plain-language explanation of the thesis, written for mobile readability |
| Catalysts | Ranked list of bullish drivers with source attribution |
| Risks | Ranked list of bearish risks or headwinds |
| Agent signals | Collapsible per-agent breakdowns (Macro, News, Fundamentals, etc.) |
Caching & Performance
Market data responses are cached in Redis with short TTLs (seconds to minutes depending on data type). Real-time quotes are cached for 15 seconds. Fundamental snapshots are cached for up to 24 hours. Macro snapshots are refreshed every hour via a Celery scheduled task.
This layered caching strategy lets the platform serve fast responses during peak usage without hammering vendor APIs on every request.
