A multi-agent AI system for comprehensive financial analysis and market research. This project combines web search capabilities with financial data analysis to provide intelligent insights about stocks, market trends, and investment opportunities.
The Financial AI Analyst uses a team of specialized AI agents to gather and analyze financial information:
- Web Search Agent: Searches the web for current market news, trends, and general financial information
- Finance Agent: Retrieves and analyzes real-time stock data, analyst recommendations, and company fundamentals
- Multi-Agent Coordinator: Orchestrates the agents to provide comprehensive financial analysis
- Real-time stock price monitoring and analysis
- Analyst recommendations and market sentiment analysis
- Company fundamentals and financial metrics
- Current market news and trends research
- Interactive web playground for agent testing
- Structured data presentation in tables and markdown format
New to this project? Start here:
- Set up your environment β Installation
- Get your API keys β Environment Configuration
- Run your first analysis β
python financial_agent.py - Try the interactive playground β
python playground.py
Financial-AI-Analyst/
βββ .env.sample # Environment variables template
βββ .gitignore # Git ignore rules
βββ .python-version # Python version specification
βββ financial_agent.py # Main agent implementation
βββ playground.py # Interactive web playground
βββ pyproject.toml # Project configuration
βββ README.md # This file
βββ requirements.txt # Python dependencies
βββ uv.lock # Dependency lock file
- Python 3.8 or higher
- Groq API key for accessing AI models
- Agno API key for the playground interface
git clone https://github.com/GoJo-Rika/Financial-AI-Analyst.git
cd Financial-AI-AnalystUsing uv (recommended):
uv venv
source .venv/bin/activateOr using venv:
python -m venv venv
source venv/bin/activateOr using conda:
conda create -n financial-ai python=3.9
conda activate financial-ai# Using uv
uv add -r requirements.txt
# Using pip
pip install -r requirements.txtCopy the sample environment file and configure your API keys:
cp .env.sample .envEdit the .env file and add your API keys:
GROQ_API_KEY=your_groq_api_key_here
AGNO_API_KEY=your_agno_api_key_here- Groq API Key: Visit Groq Console to obtain your API key
- Agno API Key: Visit Agno Settings to get your API key
The main financial analysis can be executed directly:
ur run financial_agent.py
# or
python3 financial_agent.pyThis will run a sample analysis for Apple (AAPL) stock, providing:
- Analyst recommendations
- Current stock price
- Market sentiment analysis
- Comprehensive summary with sources
For a more interactive experience, launch the web playground:
uv run playground.py
# or
python3 playground.pyThis starts a web server (typically at http://localhost:8000) where you can:
- Interact with agents through a web interface
- Test different queries and scenarios
- View real-time responses from both agents
- Experiment with various financial analysis requests
You can modify the queries in financial_agent.py to analyze different stocks or ask specific questions:
# Example: Analyze multiple stocks for long-term investment
multi_ai_agent.print_response(
"Analyze companies like Tesla, NVDA, Apple and suggest which to buy for long term"
)
# Example: Get market sentiment for a specific sector
multi_ai_agent.print_response(
"What is the current market sentiment for technology stocks?"
)- Purpose: Gathers current market news, sentiment, and trends
- Model: Llama 3.1 8B Instant
- Tools: DuckDuckGo search
- Instructions: Always includes sources for information
- Purpose: Retrieves real-time financial data and metrics
- Model: Gemma2 9B IT
- Tool: Yahoo Finance integration (YFinance)
- Capabilities:
- Real-time stock prices
- Analyst recommendations
- Company fundamentals
- Company news
- Instructions: Presents data in structured tables
- Purpose: Orchestrates both agents and synthesizes results
- Model: Gemma2 9B IT
- Process: Delegates tasks β Combines results β Formats output
When you ask: "Summarize analyst recommendations and share stock price for AAPL"
- Multi-Agent Coordinator receives the query
- Finance Agent is called:
- Uses
YFinanceToolsto fetch AAPL stock data - Retrieves current price, analyst recommendations, fundamentals
- Formats data into structured tables
- Uses
- Web Search Agent is called:
- Uses
DuckDuckGoToolsto search for recent AAPL news - Gathers market sentiment and current events
- Includes source citations
- Uses
- Coordinator combines both results:
- Synthesizes financial data with market context
- Creates comprehensive analysis
- Presents in markdown format with tables
You can customize agent behavior by modifying their configurations:
# Finance Agent Tool Configuration
YFinanceTools(
stock_price=True, # Enable real-time price data
analyst_recommendations=True, # Include analyst ratings
stock_fundamentals=True, # Company financial metrics
company_news=True, # Latest company news
)
# Agent Behavior Settings
instructions="Use tables to display the data" # Output formatting
show_tool_calls=True # Debug visibility
markdown=True # Formatted outputThe project uses Groq models:
llama-3.1-8b-instant: Fast responses for web searchesgemma2-9b-it: Balanced performance for financial analysis
Here are some example queries you can try:
- "Analyze the current market sentiment for NVDA and provide buy/sell recommendations"
- "Compare the financial fundamentals of Apple, Microsoft, and Google"
- "What are the latest news and analyst opinions on Tesla stock?"
- "Identify promising growth stocks in the technology sector"
- "Analyze the impact of recent Fed decisions on bank stocks"
API Key Errors:
- Ensure your
.envfile contains valid API keys - Check that environment variables are properly loaded
Installation Issues:
- Verify Python version compatibility
- Try upgrading pip:
pip install --upgrade pip - Consider using a virtual environment
Agent Response Issues:
- Check your internet connection for web search functionality
- Verify API key permissions and rate limits
- Ensure stock symbols are valid when querying financial data
Enable debug mode by setting show_tool_calls=True in agent configurations to see detailed tool usage.
When contributing to this project:
- Follow the existing code structure and naming conventions
- Add appropriate error handling for API calls
- Include docstrings for new functions and classes
- Test your changes with different stock symbols and queries
- Update this README if you add new features
This project is open source. Please check the license file for specific terms.
For questions or issues:
- Check the troubleshooting section above
- Review the Agno and Groq documentation
- Create an issue in the project repository
Note: This tool is for educational and research purposes. Always consult with financial professionals before making investment decisions.