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.
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.
Copy
Ask AI
---provider: openaimodel: gpt-41type: agentagents: - market_researcher - price_analyzertemperature: 0.2schema: 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 indicatorsProcess each request systematically:1. Analyze the requested stocks/sectors2. Gather current price data from Yahoo Finance and recent market news3. Calculate technical indicators using code execution4. Identify market trends and sentiment5. 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.
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.
Show stock_symbols
This parameter accepts a list of stock ticker symbols to analyze. Examples:
AAPL, MSFT, GOOGL for individual stocks
SPY, QQQ, IWM for ETFs
TSLA, NVDA, AMD for sector-specific analysis
Show market_focus
This parameter defines the analytical perspective or theme for the analysis. Examples:
earnings season impact
pre-market analysis
sector rotation trends
daily wrap-up
volatility assessment
This guides both the market researcher and price analyzer agents on which aspects to emphasize in their analysis.
Show analysis_depth
This parameter controls the comprehensiveness of the analysis. Options include:
summary - Quick overview with key points
comprehensive - Detailed analysis with full technical indicators
deep-dive - Extensive research with multiple data sources
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.
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.