An AI-powered financial analysis system that provides comprehensive investment insights by combining data from multiple sources. This project demonstrates the same financial analysis system implemented using four different agent frameworks: LlamaIndex, CrewAI, LangChain, and AG2 (formerly AutoGen).
FinanceAgents is a multi-agent system that answers financial queries by orchestrating specialized AI agents. When you ask a financial question, the system automatically:
- Analyzes your query to extract company names and stock tickers
- Selects relevant agents based on your question type
- Runs agents in parallel for fast, comprehensive analysis
- Synthesizes results into a cohesive investment report
All in seconds, giving you:
- 📊 Real-time stock data from Yahoo Finance
- 📄 SEC filing analysis from regulatory documents
- 💬 Social sentiment from Reddit discussions
- 📚 Internal document analysis using RAG (Retrieval-Augmented Generation)
- 🎯 Comprehensive summary synthesizing all insights
This repository contains four separate implementations of the same financial analysis system:
FinanceAgents/
├── llamaindex_agents/ # LlamaIndex Workflow implementation
├── crewai_agents/ # CrewAI implementation
├── langchain_agents/ # LangChain implementation
├── ag2_agents/ # AG2 (formerly AutoGen) implementation
├── shared_lib/ # Shared agents, schemas, and utilities
├── config/ # Configuration data files
├── raw_data/ # Financial PDF documents
└── README.md # This file
| Framework | Architecture | Orchestration | Key Features |
|---|---|---|---|
| LlamaIndex | Event-driven workflow | Declarative workflow steps | Robust parallel execution, built-in timeout handling |
| CrewAI | Router-based | Concurrent async execution | Agent crew coordination, MCP protocol |
| LangChain | Router-based | Semantic similarity routing | Query classification via sentence transformers |
| AG2 | ConversableAgent + GroupChat | Concurrent async execution (deterministic router) + LLM-driven group chat demo | Tool-registration pattern, coordinator/executor split |
All four implementations share:
- Specialized Agents: Finance, Yahoo, SEC, Reddit, General agents
- RAG Capabilities: Vector database with HuggingFace embeddings
- Dual Interface: REST API + Interactive CLI
- MCP Protocol: Standardized agent communication
- Parallel Processing: Fast concurrent agent execution
Each implementation is self-contained in its own directory. Navigate to the implementation you want to use:
- llamaindex_agents/ - Recommended for production use (most robust)
- crewai_agents/ - Great for crew-based agent coordination
- langchain_agents/ - Best for semantic query routing
- ag2_agents/ - AG2 / AutoGen ConversableAgent + GroupChat patterns
Each directory contains its own README with detailed setup instructions.
All implementations require:
- Python 3.8+
- OpenAI API key
- Reddit API credentials (optional, for sentiment analysis)
# Navigate to implementation directory
cd llamaindex_agents
# Install dependencies
pip install -r requirements.txt
# Run the application
env $(cat ../.env) python src/main.pySee each implementation's README for specific setup instructions.
All implementations use these specialized agents:
| Agent | Purpose | Data Source |
|---|---|---|
| FinanceAgent | Analyze internal financial documents | PDF documents via RAG/Vector DB |
| YahooAgent | Real-time stock data and metrics | Yahoo Finance API |
| SECAgent | Regulatory filings and compliance | SEC EDGAR API |
| RedditAgent | Market sentiment analysis | Reddit API (r/stocks, r/investing) |
| GeneralAgent | General context and information | GPT-powered responses |
User Query
↓
Query Analysis (Extract companies/tickers)
↓
Agent Selection (Determine relevant agents)
↓
Parallel Agent Execution (Finance, Yahoo, SEC, Reddit, General)
↓
Response Enhancement (LLM improves each output)
↓
Summary Generation (Synthesize comprehensive report)
↓
Final Response
Try these queries with any implementation:
Stock Analysis:
Tell me about Tesla stock
Company Comparison:
Compare Apple and Microsoft stocks
Market Sentiment:
What is the sentiment around NVIDIA on social media?
Document Analysis:
What are the key metrics in Apple's financial reports?
Multi-company Analysis:
Analyze the tech sector: Apple, Microsoft, Google, and Amazon
Create a .env file in the implementation directory you're using:
OPENAI_API_KEY=your_openai_api_key_here
REDDIT_CLIENT_ID=your_reddit_client_id_here
REDDIT_CLIENT_SECRET=your_reddit_client_secret_hereTo enable document analysis:
- Create a
raw_data/directory in your chosen implementation folder - Add PDF financial documents with format:
company-year.pdf(e.g.,apple-2023.pdf) - The system will automatically build a vector index on first run
Built-in mappings for major companies:
- Apple (AAPL), Microsoft (MSFT), Google/Alphabet (GOOG)
- Amazon (AMZN), Meta/Facebook (META), Tesla (TSLA)
- NVIDIA (NVDA), Netflix (NFLX), Intel (INTC), IBM (IBM)
Add new companies by:
- Adding PDF documents to
raw_data/ - Updating
config/companies.jsonwith the company name and ticker
- OpenAI GPT-3.5/4: Language models for analysis and synthesis
- HuggingFace: Embedding models for semantic search
- ChromaDB: Vector database for document storage
- FastAPI: REST API framework
- yfinance: Yahoo Finance data access
- PRAW: Reddit API client
- LlamaIndex: Workflow orchestration and RAG
- CrewAI: Multi-agent crew coordination
- LangChain: Agent chaining and semantic routing
- AG2: ConversableAgent + GroupChatManager with tool registration
This project is ideal for:
- Learning different agent frameworks and their trade-offs
- Understanding RAG (Retrieval-Augmented Generation) systems
- Building multi-agent financial analysis systems
- Comparing workflow vs router architectures
- Exploring parallel agent execution patterns
- LlamaIndex Implementation - Event-driven workflow architecture
- CrewAI Implementation - Crew-based agent coordination
- LangChain Implementation - Semantic routing (see
langchain_agents/CLAUDE.md) - AG2 Implementation - ConversableAgent + GroupChat patterns
Each implementation is independently maintained. To contribute:
- Choose the implementation you want to enhance
- Follow that implementation's development guidelines
- Test your changes thoroughly
- Submit a pull request with clear description
This project demonstrates AI agent frameworks for educational purposes. Ensure compliance with API terms of service (OpenAI, Yahoo Finance, Reddit, SEC) when deploying.
This system is for educational and research purposes only. It is not financial advice. Always consult with qualified financial professionals before making investment decisions.
Choose your framework and start analyzing! 🚀