The AI Finance Agent Team demonstrates how to build a collaborative team of AI agents that work together as financial analysts. This system combines web search capabilities with real-time financial data analysis tools to provide comprehensive financial insights in just 20 lines of Python code.
# Example flow for combined queryUser: "Analyze TSLA stock and recent news"1. Team Agent receives query2. Routes to Finance Agent first - Gets stock price - Gets analyst recommendations - Gets company financials3. Routes to Web Agent - Searches for recent news - Finds market sentiment4. Team Agent combines insights5. Returns comprehensive analysis
# Get current stock pricedef get_current_stock_price(ticker: str) -> dict: """ Get the current stock price for a ticker symbol. Args: ticker: Stock ticker symbol (e.g., 'AAPL', 'TSLA') Returns: dict: Current price, day high/low, volume, etc. """
Example:
Query: "What is AAPL stock price?"Response: | Metric | Value ||--------|-------|| Price | $178.32 || High | $179.50 || Low | $177.20 || Volume | 45.2M |
# Get analyst recommendationsdef get_analyst_recommendations(ticker: str) -> dict: """ Get analyst recommendations and ratings. Args: ticker: Stock ticker symbol Returns: dict: Buy/Sell/Hold recommendations, price targets """
# Get company informationdef get_company_info(ticker: str) -> dict: """ Get detailed company information. Args: ticker: Stock ticker symbol Returns: dict: Company details, sector, market cap, etc. """
Example:
Query: "Get information about Microsoft"Response:| Field | Value ||-------|-------|| Name | Microsoft Corporation || Sector | Technology || Industry | Software || Market Cap | $2.8T || Employees | 221,000 |
# Get company newsdef get_company_news(ticker: str) -> list: """ Get recent news articles about the company. Args: ticker: Stock ticker symbol Returns: list: Recent news articles with links """
Example:
Query: "What's the latest news on NVDA?"Response:- NVIDIA Announces New AI Chip (2 hours ago)- Q3 Earnings Beat Expectations (1 day ago)- Partnership with Major Cloud Provider (2 days ago)
User: "Research the semiconductor industry and check NVDA"Web Agent:- Industry growing at 8.6% CAGR- AI chip demand driving growth- Supply chain improving- Major players: NVIDIA, AMD, IntelFinance Agent:NVIDIA (NVDA):- Price: $495.50- Market Cap: $1.2T- Forward P/E: 35.2- Revenue Growth: 126% YoYTeam Analysis:Semiconductor sector shows strong growth driven by AI.NVDA is industry leader with commanding market share.Stock trading at premium but justified by growth.
Comparative Analysis
User: "Compare Tesla and traditional automakers"Finance Agent:| Company | Price | P/E | Market Cap ||---------|-------|-----|------------|| TSLA | $242.50 | 75.3 | $770B || F | $12.40 | 6.2 | $50B || GM | $32.10 | 5.8 | $42B |Web Agent:- EV market growing rapidly- Tesla leads in innovation- Traditional automakers catching up- Battery technology key differentiatorTeam Analysis:Tesla commands premium valuation due to tech leadership.Traditional automakers cheaper but slower EV transition.Market favors growth and innovation in auto sector.