← Back to systems
LLM System

Multi-Agent Investment Advisor

LangGraphOpenAIFastAPIPinecone

Context

This system was built to reduce the time required to produce first-pass equity research. The target workflow combined internal portfolio context, external market data, news search, and risk review into a single advisory assistant.

The core engineering challenge was not just answer generation. The system needed to coordinate multiple tools, keep intermediate state traceable, and force a risk-review step before producing a recommendation.

Problem

Investment analysis has several failure modes that map poorly to a single prompt:

  • Fragmented data access: price data, news, internal context, and benchmark companies live behind different interfaces.
  • Inconsistent reasoning flow: analysts may skip risk review or overweight the first narrative they find.
  • Slow reporting loop: producing a structured memo requires repetitive retrieval, synthesis, and formatting.
  • Auditability: finance stakeholders need to understand which data was used and why a conclusion was reached.

Architecture

I used LangGraph to model the workflow as a controlled graph instead of a free-form chat loop. Each node had a narrow responsibility and shared state through the graph.

Components

  • Manager Agent: routes the request, tracks state, and decides when enough evidence has been collected.
  • Market Searcher: calls market, news, and benchmarking tools in parallel.
  • Sentiment Analyst: converts retrieved context into structured signals.
  • Risk Auditor: checks for contradictory evidence, missing assumptions, and overconfident recommendations.
  • FastAPI service boundary: exposes the workflow to the application layer and keeps agent execution isolated from UI concerns.

Key Decisions

Sequential graph over one general ReAct agent

Financial advisory workflows need a consistent order: retrieval, analysis, risk review, then recommendation. A flat agent can answer quickly but may skip risk review when the prompt pressure is high. The graph made risk review mandatory.

Shared graph state over message-only context

Important evidence such as retrieved news, benchmark companies, and intermediate analysis was stored in graph state. This made the workflow easier to inspect, debug, and pass between nodes without relying on long chat history.

Parallel tool calls for retrieval-heavy steps

The market search step can fan out to multiple tools, including market data, web search, and benchmarking sources. Running those lookups in parallel reduced end-to-end report latency.

Reliability & Evaluation

  • Added a max-recursion guard so the workflow converges instead of cycling between agents.
  • Added a risk-auditor node to flag contradictory data before final output.
  • Added a human-approval state for high-conviction or high-risk recommendations.
  • Structured intermediate outputs so each stage could be inspected during debugging.

What I Owned

  • Designed the LangGraph workflow across retrieval, analysis, risk review, and final recommendation stages.
  • Built the FastAPI service boundary for agent execution and downstream integration.
  • Added cycle-prevention, risk-auditor checks, and human approval states for higher-risk outputs.

Impact

  • Reduced time-to-report for standard equity analysis by about 70%.
  • Improved analysis speed by about 2x for finance management reporting workflows.
  • Enabled automated stock performance reporting with explicit risk-review checkpoints.
  • The risk-auditor agent flagged contradictory financial data in 15% of reviewed cases.

The goal was not to replace the analyst. It was to turn the analyst into an editor of higher-quality synthesized leads.