AI Agents for Finance Series — Part 2 of 5

Agent Architectures — ReAct, Tool-Use & Multi-Agent

The engineering patterns behind autonomous financial agents. From the ReAct reasoning loop to multi-agent analyst teams, MCP tool integration, memory management, and the orchestration patterns that make it all work.

ReAct Pattern MCP & Tool-Use Multi-Agent Memory Systems
AI Agents for Finance2/5
ReAct PatternTool-Use & MCPChain-of-ThoughtMulti-Agent SystemsOrchestrationMemory & ContextKey Takeaways
The Foundation Pattern

The ReAct Pattern: Reason + Act

ReAct (Reason + Act) is the foundational architecture behind virtually every production AI agent in 2026. Published by Yao et al. at Princeton in 2023, the pattern is deceptively simple: instead of generating a complete response in one shot, the agent alternates between reasoning (thinking about what to do) and acting (doing it), using the observation from each action to inform the next reasoning step.

The ReAct Loop
Thought → Action → Observation → Thought → ...

Here is what a ReAct loop looks like for a financial analysis task:

ReAct Loop — Analyzing AAPL
// Iteration 1
Thought: I need to analyze AAPL. First, let me get the current quote
         and recent price action to understand where the stock is trading.
Action:  QueryData(types=["quote","bars_daily"], symbols=["AAPL"])
Observation: AAPL $198.50 (+1.2%), 52W range $164-$237, PE 33.2,
             RSI 58, above 50-day EMA, volume declining...

// Iteration 2
Thought: Price is mid-range, RSI neutral. I need earnings data to
         understand the fundamental picture and upcoming catalysts.
Action:  QueryData(types=["earnings_quarterly","analyst_actions"],
                  symbols=["AAPL"])
Observation: Last quarter: beat by $0.07, revenue +5% YoY.
             12 upgrades, 3 downgrades last 90 days...

// Iteration 3
Thought: Fundamentals solid but priced in. Let me check sentiment
         and insider activity for edge signals.
Action:  QueryData(types=["sentiment_overall","insider_transactions"],
                  symbols=["AAPL"])
Observation: Sentiment: 72% bullish, insider selling $45M last quarter,
             short interest 0.8%...

// Iteration 4
Thought: Insider selling is notable. Let me search for recent news to
         understand if there is a specific catalyst or concern.
Action:  WebSearch("AAPL Apple insider selling 2026 reason")
Observation: Tim Cook sold $50M in scheduled 10b5-1 plan. CFO sold
             $12M. Both are routine pre-planned sales...

// Iteration 5
Thought: Insider selling is routine (10b5-1 plans), not a red flag.
         I now have enough data to write a comprehensive analysis.
         AAPL is a HOLD with neutral technical setup and solid
         fundamentals. Let me generate the report.
Action:  Write("analyses/AAPL/index.html", content=...)

Why ReAct Beats Direct Prompting

Without ReAct, you would ask "Analyze AAPL" and get a single response based on training data (possibly hallucinated). With ReAct, the agent grounds every claim in real data it fetched during the loop. Each thought explicitly references the observation from the previous action. This creates an auditable chain of reasoning where you can trace every conclusion back to its data source.

ReAct vs. Alternative Patterns

Pattern How It Works Strengths Weaknesses
ReAct Interleave reasoning and acting, observe results Self-correcting, grounded, auditable Slower (many LLM calls), higher token cost
Plan-then-Execute Generate full plan first, execute all steps Faster, lower cost, parallelizable Cannot adapt if early steps fail or return unexpected data
Reflexion ReAct + explicit self-evaluation after each loop Better quality, catches more errors Even slower, much higher token cost
Tree-of-Thought Explore multiple reasoning paths in parallel Better for ambiguous problems Expensive, complex orchestration
Connecting to the World

Tool-Use: MCP, Function Calling & Plugins

Tools are what transform an LLM from a text generator into an agent. Without tools, the model can only produce text based on its training data. With tools, it can interact with the real world: fetch live data, execute code, write files, browse the web, and trigger external systems.

How Tool-Use Works

The process follows a strict protocol:

1
Tool Discovery
The agent receives a manifest of available tools with their names, descriptions, and parameter schemas (JSON Schema).
2
Tool Selection
Based on its reasoning, the agent decides which tool to call and constructs the parameters as a structured JSON object.
3
Tool Execution
The runtime (Claude Code, LangGraph, etc.) executes the tool call and captures the result. The agent never executes tools directly.
4
Result Integration
The tool result is injected back into the conversation context. The agent reasons about the result and decides what to do next.

MCP: The Universal Connector

Anthropic's Model Context Protocol (MCP) solved the fragmentation problem in AI tool ecosystems. Before MCP, every framework (LangChain, AutoGPT, CrewAI) had its own tool definition format. MCP created an open standard that any data provider can implement once, and any agent can consume.

MCP Tool Definition (Simplified)
// An MCP server exposes tools with JSON Schema
{
  "name": "QueryData",
  "description": "Query financial data by type and symbol",
  "parameters": {
    "type": "object",
    "properties": {
      "types": {
        "type": "string",
        "description": "Comma-separated data types: quote, bars_daily, ..."
      },
      "symbols": {
        "type": "string",
        "description": "Comma-separated ticker symbols"
      }
    },
    "required": ["types", "symbols"]
  }
}

The USB Analogy

Before USB, every peripheral had a proprietary connector. Printers, keyboards, mice, cameras — all different plugs. USB created a universal standard. MCP does the same for AI tools. A financial data provider builds one MCP server, and it instantly works with Claude Code, Cursor, Windsurf, and any other MCP-compatible agent. This is why the DailyTickers Gateway serves 58+ data types through a single MCP interface — any agent can use it without custom integration code.

Tool Ecosystem for Finance

Tool Category Examples Finance Use MCP Available
Market Data MW Gateway, Bloomberg, Polygon.io Quotes, bars, technicals, options MW Gateway, Polygon
Web Search Brave Search, Google, Bing News, earnings previews, macro events Brave Search
Document Analysis SEC EDGAR, PDF readers 10-K/Q filings, prospectuses Limited
Code Execution Bash, Python, Node.js Backtesting, statistics, visualization Native in Claude Code
File System Read, Write, Glob, Grep Report generation, template management Native in Claude Code
Communication Slack, Discord, Email Alerts, report distribution Slack, Discord
Structured Reasoning

Chain-of-Thought for Financial Analysis

Chain-of-thought (CoT) prompting forces the model to show its reasoning step by step, rather than jumping directly to conclusions. In financial analysis, this is critical because conclusions without visible reasoning are unauditable and untrustworthy.

Standard CoT vs. Financial CoT

Standard CoT (Generic)
User: Should I buy AAPL?
Model: Let me think step by step...
  1. AAPL is a large-cap tech stock
  2. It has strong fundamentals
  3. The market is generally positive
  → Generic, no data, no rigor
Financial CoT (Structured)
User: Analyze AAPL for a swing trade opportunity
Agent:
// Step 1: Technical Setup
Price: $198.50 (source: live quote via MCP)
RSI(14): 58 — neutral, not overbought/oversold
Price vs EMAs: above EMA20 ($195.20), above EMA50 ($191.80)
Volume: declining 3 consecutive days (distribution?)
Support: $192 (EMA50 + horizontal), Resistance: $205 (prior high)
Technical Score: 6/10 — Neutral with slight bullish bias

// Step 2: Fundamental Check
PE: 33.2x vs sector 28.5x — premium but justified by margins
Revenue growth: +5% YoY — decelerating
EPS beat: 4 consecutive quarters
FCF yield: 3.1% — healthy
Fundamental Score: 7/10 — Solid but fully priced

// Step 3: Sentiment & Flow
Analyst consensus: 82% Buy, PT avg $215 (+8.3% upside)
Insider activity: routine 10b5-1 sales (not bearish)
Short interest: 0.8% — minimal
Social sentiment: 72% bullish (StockTwits)
Sentiment Score: 7/10 — Positive but crowded

// Step 4: Synthesis
Composite: (6 + 7 + 7) / 3 = 6.7/10
Verdict: HOLD — wait for pullback to EMA50 ($191.80) for
better entry. No clear catalyst for immediate breakout above $205.
Trade idea: Buy at $192 / Stop $186 / TP $205 / R:R 2.2:1

Why Structure Matters

The financial CoT template above does three things the generic version doesn't: (1) every claim has a data source, (2) each dimension gets a numerical score enabling comparison across stocks, and (3) the synthesis explicitly shows how sub-scores combine into a conclusion. This is the difference between "I think you should buy AAPL" and "Based on these 12 data points, here is a calibrated assessment." The latter is auditable, reproducible, and trustworthy.

Structured Output Schemas

Modern agent systems can force the model to output structured JSON that conforms to a predefined schema. This eliminates parsing errors and ensures consistency across analyses.

Structured Analysis Output Schema
{
  "ticker": "AAPL",
  "date": "2026-03-06",
  "scores": {
    "technical": 6, "fundamental": 7,
    "sentiment": 7, "composite": 6.7
  },
  "verdict": "HOLD",
  "trade": {
    "entry": 192, "stop": 186,
    "tp1": 205, "rr": 2.2
  },
  "confidence": 0.72,
  "sources": ["MCP:quote", "MCP:bars_daily", "web:Reuters"]
}
Teams of Agents

Multi-Agent Systems for Finance

A single agent can perform a single task well. But financial decision-making involves multiple perspectives that benefit from specialization. Multi-agent systems assign different "roles" to different agent instances, each with specialized prompts, tools, and knowledge.

The Investment Committee Pattern

The most natural multi-agent architecture for finance mirrors how real investment teams operate:

Technical Analyst Agent

Specializes in chart patterns, support/resistance, momentum indicators, volume analysis. Uses bars_daily, technicals, support_resistance tools.

Fundamental Analyst Agent

Focuses on financials, earnings quality, valuation multiples, competitive positioning. Uses financials, earnings_quarterly, analyst_actions tools.

Sentiment/News Agent

Monitors social media, news flow, insider transactions, short interest. Uses sentiment_overall, news, insider_transactions, web search tools.

Risk Manager Agent

Evaluates portfolio exposure, correlation risk, position sizing, stop levels. Uses portfolio VaR, options greeks, correlation analysis tools.

Multi-Agent Orchestration (Pseudocode)
// CrewAI-style multi-agent setup for stock analysis

analyst_crew = Crew(
  agents = [
    Agent(role="Technical Analyst",
          tools=[QueryData, GetInstruments],
          goal="Evaluate technical setup and chart patterns"),

    Agent(role="Fundamental Analyst",
          tools=[QueryData, WebSearch],
          goal="Assess financial health and valuation"),

    Agent(role="Sentiment Analyst",
          tools=[QueryData, WebSearch],
          goal="Gauge market sentiment and news flow"),

    Agent(role="Risk Manager",
          tools=[CalculatePortfolioVaR, CalculateOptionsGreeks],
          goal="Define position sizing and risk parameters"),

    Agent(role="Report Writer",
          tools=[Write, Bash],
          goal="Synthesize all inputs into HTML report")
  ],
  tasks = [
    Task("Analyze NVDA technical setup", agent="Technical Analyst"),
    Task("Evaluate NVDA fundamentals", agent="Fundamental Analyst"),
    Task("Assess NVDA sentiment", agent="Sentiment Analyst"),
    Task("Calculate risk parameters", agent="Risk Manager",
         depends_on=["Technical Analyst", "Fundamental Analyst"]),
    Task("Write final report", agent="Report Writer",
         depends_on=["all"])
  ],
  process = "hierarchical"  // manager coordinates agents
)

Single Agent vs. Multi-Agent: When to Use What

Criteria Single Agent Multi-Agent
Task Complexity Simple to moderate (one perspective) Complex (multiple perspectives needed)
Latency Faster (sequential reasoning) Slower (coordination overhead) or faster (parallel)
Cost Lower (one context window) Higher (multiple context windows)
Quality Good for well-defined tasks Better for nuanced decisions with trade-offs
Debugging Easy (one reasoning chain) Complex (must trace across agents)
Best For Daily briefings, scanner runs, single ticker analysis Portfolio construction, investment committee decisions, complex trades

The Multi-Agent Trap

Many teams reach for multi-agent systems too early. A single well-prompted agent with good tools (like Claude Code + MCP Gateway) can handle 90% of financial analysis tasks. Multi-agent adds complexity, debugging difficulty, and cost. Use it when you genuinely need divergent perspectives (bull vs. bear debate) or specialized tool sets (one agent for options math, another for fundamental analysis). Do not use it just because it sounds cooler.

Workflow Patterns

Orchestration Patterns

Orchestration is the glue that holds an agent system together. It determines the order of operations, how agents communicate, and how errors are handled. Three primary patterns dominate production systems.

Pattern 1: Sequential Pipeline

Each step feeds into the next, like an assembly line. Simple, predictable, easy to debug.

Sequential: Daily Briefing Pipeline
Step 1: GetMarketOverview(depth="deep")
        → Captures indices, commodities, crypto, rates, sentiment
Step 2: QueryData(types="quote,bars_daily", symbols="SPY,QQQ,...")
        → Gets detailed data for all tracked assets
Step 3: WebSearch("economic calendar today", "earnings today", ...)
        → Finds macro events, earnings, geopolitical news
Step 4: Generate HTML report using all collected data
        → Writes daily/YYYYMMDD/index.html
Step 5: Index and deploy
        → add_card.js → git commit → git push

Pattern 2: Parallel Fan-Out / Fan-In

Independent tasks execute simultaneously, then results merge. Faster but requires careful coordination.

Parallel: Scanner Pipeline
// Fan-out: run all screeners simultaneously
parallel {
  RunAutoScreener()              → regime detection + candidates
  RunScreener(dsl="oversold")    → oversold bounce candidates
  RunScreener(dsl="momentum")    → momentum breakout candidates
  RunScreener(dsl="breakout")    → technical breakout candidates
  RunScreener(symbols="EU list") → European candidates
  RunScreener(symbols="APAC")    → Asia-Pacific candidates
}

// Fan-in: merge and deduplicate all candidates
merge all_candidates
  → deduplicate by ticker
  → score by composite (technical + fundamental + sentiment)
  → validate spot prices (P0 check: ±10% tolerance)
  → select top 10 with geographic diversification
  → generate report

Pattern 3: Hierarchical (Manager + Workers)

A manager agent decomposes the task and delegates to specialized worker agents. The manager reviews outputs and coordinates revisions.

Choosing the Right Pattern

Sequential is best for well-defined workflows with clear data dependencies (daily briefings, single ticker analysis). Parallel is best when you need speed and the subtasks are independent (scanner with multiple strategies). Hierarchical is best for complex, open-ended tasks where the decomposition itself requires judgment (portfolio construction, investment committee simulation). In practice, most production systems use a hybrid: sequential at the top level with parallel sub-steps for data collection.

Persistent Intelligence

Memory & Context Management

200K tokens sounds like a lot — until you try to fit a full market overview, 10 days of scanner results, 5 retrospective analyses, and an 80KB HTML template into a single context window. Memory management is the unglamorous but critical engineering challenge of production agent systems.

The Context Budget Problem

Content Type Typical Size Token Estimate
System prompt (CLAUDE.md) 15 KB ~5,000 tokens
Market overview (deep) 25 KB ~8,000 tokens
10 scanner results 100 KB each ~300,000 tokens (too much!)
Reference HTML template 80 KB ~25,000 tokens
Retrospective analyses (5x) 50 KB each ~75,000 tokens
Total needed ~475 KB ~413,000 tokens
Available (Claude) 200,000 tokens

The total context needed is 2x the available window. This is why every production agent needs a memory management strategy.

Strategy 1: Summarization

Instead of reading full 80KB scanner reports, the agent reads them and produces a 2KB summary of key findings: hit rates, top/flop tickers, strategy adjustments. The summary is stored and reused in future sessions.

Strategy 2: Selective Loading

Load only what you need. For a scanner run, you need the most recent retrospective in full, but only the ticker lists from older scans. CLAUDE.md is always loaded because it contains the operating instructions.

Strategy 3: RAG (Retrieval-Augmented Generation)

Store all past analyses in a vector database. When generating a new analysis, retrieve only the most relevant past analyses (same sector, similar market regime, same ticker history). This is the most scalable approach but adds infrastructure complexity.

Strategy 4: Episodic Memory Files

The simplest and most effective pattern for file-based agent systems. The agent maintains a MEMORY.md file that accumulates key learnings across sessions:

Episodic Memory Example
# MEMORY.md — Auto-maintained by agent

## Scanner Learnings (Updated 2026-03-05)
- Momentum strategy hit rate: 68% (12 retros cumulative)
- Oversold bounce: 54% — reduce weight from 0.25 to 0.15
- Energy sector: 3 consecutive false signals — add stricter
  volume filter (> 1.5x average)
- APAC picks: underperforming US by 12% — increase US weight
- Optimal stop: ATR(14) x 1.5 works better than fixed %

## User Preferences
- Prefers conservative allocation (60/40)
- Wants trade ideas on every analysis (not just tickers)
- French language for weekly, English for analyses

The Memory Hierarchy

Think of agent memory like a computer's memory hierarchy. Registers (fastest) = the current reasoning step. L1 cache = the conversation context window. L2 cache = MEMORY.md and summary files. RAM = full file system (read on demand). Disk = vector database for historical retrieval. Each level is slower to access but holds more data. The art of memory management is putting the right information at the right level.

Summary

Key Takeaways

Architecture Essentials

Quiz: Test Your Understanding

Q1: What are the three steps of the ReAct loop?

A: Thought (reasoning about what to do), Action (executing a tool call), Observation (reading the result). The loop repeats until the task is complete.

Q2: Why is MCP important for financial agents?

A: MCP standardizes how agents talk to tools. A data provider implements the MCP spec once, and any MCP-compatible agent can use it. This eliminates per-framework integration work and creates an interoperable ecosystem.

Q3: When should you use multi-agent vs. single agent?

A: Use single agent for well-defined tasks (briefings, scanner runs, single stock analysis). Use multi-agent when you genuinely need divergent perspectives or specialized tool sets (portfolio construction, investment committee simulation).

Next — Part 3 of 5
Building Analyst Agents — Automated Research & Scoring
AI Agents for Finance2/5