← Back to projects
LLM System

Multi-Agent Investment Advisor

LangGraphOpenAIFastAPIPinecone

Analyzing financial markets at scale requires a delicate balance of deep data retrieval and objective reasoning. This case study explores a multi-agent system designed to act as a "Virtual Analyst," capable of navigating complex economic indicators autonomously.

Problem: The Analyst's Bottleneck

Professional investment analysis is traditionally slow and prone to human cognitive bias.

  • Data Overload: Manually scanning 10-K filings, news sentiment, and technical charts takes hours.
  • Narrative Anchoring: Once an analyst forms a thesis, they often overlook contradictory data.
  • Consistency: Different analysts produce reports with different structures and depth.

Solution: Agentic Orchestration

I built a circular graph-based system using LangGraph that orchestrates three specialized agents. Each agent has a distinct "Persona" and set of tools.

Engineering Insight: Preventing Agent Cycles

[!IMPORTANT] Autonomous agents can easily get "stuck" in infinite loops if they don't agree on a conclusion. I implemented a Max-Recursion Break and a "Tie-Breaker" node in the LangGraph state to ensure the system always converges on a report in under 60 seconds.

The "Smarter" Stack

  • State Management: Used LangGraph's global state to pass context (retrieved news, stock prices) between nodes without losing "long-term" query memory.
  • Tool-Call Optimization: Used parallel tool-calls for the Market Searcher, allowing it to fetch stock prices, news, and technical indicators simultaneously-reducing latency by 70%.
  • Human-in-the-Loop: Added a "Pending Approval" state for high-conviction trades, where the agent pauses and asks for human confirmation via a FastAPI hook before final submission.

Architectural Trade-offs

We chose a Sequential + Feedback graph rather than a flat "ReAct" agent because financial reporting requires a specific sequence: Retrieval → Analysis → Risk Check. A flat agent often skipped the risk check in its rush to provide an answer.

Impact: Scaling Intelligence

By deploying this multi-agent system, the research workflow saw:

  • -70% reduction in time-to-report for standard equity analysis.
  • Objective Auditing: The "Risk Auditor" agent successfully flagged contradictory financial data in 15% of cases that the primary analysis agent missed.
  • High Concurrency: The system can handle 50+ simultaneous company analyses, a task that would require a team of 10+ junior analysts.

"The goal wasn't to replace the analyst, but to turn them into an editor who only sees high-quality synthesized leads."