Live example

Try out this agent setup in the Latitude Playground.

Overview

This example demonstrates how to build an intelligent market analysis agent using Latitude’s multi-agent architecture. The agent can analyze requested stocks or sectors, gather current prices and breaking news, compute technical indicators, and provide actionable, well-structured investment insights. The system orchestrates research and analysis across specialized subagents for maximum efficiency and depth.

Multi-Agent Architecture

The architecture is divided into purpose-driven subagents, each responsible for a core part of the workflow:

  • main: Coordinates the entire process and synthesizes final recommendations
  • market_researcher: Gathers live news, sentiment, and trends via web search
  • price_analyzer: Fetches live prices, historical data, and computes technical indicators with code execution

The Prompts

Here you can see the three prompts—main, market_researcher, and price_analyzer—that make up the agent system. Each prompt is designed to handle a specific part of the analysis workflow.

---
provider: openai
model: gpt-41
type: agent
agents:
  - market_researcher
  - price_analyzer
temperature: 0.2
schema:
  type: object
  properties:
    market_summary:
      type: string
      description: Executive summary of current market conditions
    stock_analysis:
      type: array
      items:
        type: object
        properties:
          symbol:
            type: string
          current_price:
            type: number
          price_change:
            type: number
          sentiment:
            type: string
          key_news:
            type: array
            items:
              type: string
      description: Analysis of requested stocks
    market_trends:
      type: array
      items:
        type: string
      description: Key market trends identified
    recommendations:
      type: array
      items:
        type: object
        properties:
          action:
            type: string
          reasoning:
            type: string
      description: Investment recommendations based on analysis
  required: [market_summary, stock_analysis, market_trends]

You're an intelligent financial analysis coordinator that provides real-time market insights by combining stock price data with current market news.

You have two specialized agents:
- A market researcher that gathers news and sentiment data using web search
- A price analyzer that retrieves stock prices from Yahoo Finance and calculates technical indicators

Process each request systematically:
1. Analyze the requested stocks/sectors
2. Gather current price data from Yahoo Finance and recent market news
3. Calculate technical indicators using code execution
4. Identify market trends and sentiment
5. Provide actionable insights and recommendations

<user>
Analyze the following stocks: {{ stock_symbols }}
Market focus: {{ market_focus }}
Analysis depth: {{ analysis_depth }}
</user>

Begin by understanding the analysis requirements and coordinating data gathering.

Parameters Explained

stock-market-parameters

Latitude Playground parameters

In the main prompt, we set these three parameters to control the analysis. Here you can see an example for Tesla Stock Analysis. Below is an explanation of each parameter.

Breakdown

Let’s break down the case step-by-step to highlight each agent’s contribution.

1. Requirements Analysis

The main agent begins by clarifying the user’s goals—what stocks/sectors to analyze, market focus, and depth of analysis. This ensures downstream agents are properly scoped and that their findings are relevant.

2. Market Research

The market_researcher agent leverages real-time web search to find:

  • Breaking news and analyst reports from trusted sources (Bloomberg, Reuters, MarketWatch, Yahoo Finance)
  • Economic indicators and investor sentiment
  • Regulatory changes or company events
  • Sector and macro trends

It uses content extraction and trend identification tools to deliver structured, concise findings on factors affecting the requested stocks.

3. Price & Technical Analysis

The price_analyzer agent:

  • Retrieves current and historical stock price data from Yahoo Finance
  • Analyzes price movements, volatility, and volume
  • Calculates technical indicators such as:
    • Simple/Exponential Moving Averages (SMA, EMA)
    • Relative Strength Index (RSI)
    • MACD
    • Bollinger Bands
  • Identifies trading signals and price-based insights through code execution

4. Synthesis & Recommendation

The main agent compiles all findings into a unified report, identifying:

  • Key market trends
  • Individual stock summaries
  • Sentiment and notable news
  • Actionable investment recommendations

The output is structured using a JSON schema for consistency and ease of integration.


Why This Multi-Agent Approach Works

Splitting responsibilities keeps each agent focused and efficient:

  • market_researcher: Excels at broad, qualitative intelligence gathering using web tools
  • price_analyzer: Specializes in quantitative and computational tasks with live data
  • main: Maintains context, makes decisions, and produces high-level summaries

Benefits:

  • No single agent is overloaded
  • Context windows stay small for better LLM performance
  • The system is modular and maintainable
  • Easily swap or upgrade subagents/providers as requirements evolve

Strategic Benefits

This multi-agent, multi-provider setup is optimized for:

  • Performance: Each agent uses the most suitable model for its task
  • Cost Efficiency: Main tasks run on higher-end models, while research and analysis run on faster, lower-cost models
  • Reliability: Modular—swap out underperforming agents/providers as needed
  • Scalability: Add new specialized agents (e.g., risk assessor, macro strategist) with minimal friction

Model and provider capabilities evolve. Routinely review provider performance, costs, and integration to ensure continued fit.

Latitude makes it easy to switch providers or models at any stage. Just update the provider configuration in your prompt manager—no need to rearchitect your agent logic. For custom providers or advanced tuning, see the provider documentation.


Resources