Content
# Multi-Agent AI Application with Cryptocurrency Analysis
## Overview
This project demonstrates a sophisticated multi-agent AI system that combines real-time cryptocurrency data retrieval with automated report generation. Built using LangChain and LangGraph, the application orchestrates multiple specialized agents through a supervisor pattern to analyze Bitcoin investment opportunities and generate comprehensive reports.
## Features
- **Multi-Agent Architecture**: Coordinated system of specialized AI agents
- **Real-time Cryptocurrency Data**: Integration with CoinGecko API via Model Context Protocol (MCP)
- **Automated Report Generation**: AI-powered document creation with structured analysis
- **Azure OpenAI Integration**: Leverages Azure's GPT models for intelligent responses
- **Supervisor Pattern**: Intelligent task delegation and workflow orchestration
## Architecture
The system consists of three main components:
### 1. Crypto Agent
- **Purpose**: Fetches real-time cryptocurrency prices and market data
- **Data Source**: CoinGecko API via MCP (Model Context Protocol)
- **Capabilities**: Current prices, market trends, historical data
### 2. Document Writer Agent
- **Purpose**: Generates comprehensive investment reports
- **Output Format**: Structured reports with market analysis and recommendations
- **Report Sections**:
- Introduction on market landscape
- Investment Strategy
- Performance Analysis
- Recommendations
- Conclusion
- References
### 3. Supervisor Agent
- **Purpose**: Orchestrates workflow between agents
- **Responsibilities**: Task delegation, coordination, and result compilation
- **Workflow**: Sequential agent execution with intelligent handoffs
## Prerequisites
- Python 3.8+
- Azure OpenAI API access
- Environment variables configured (see Configuration section)
## Installation
1. **Clone the repository** (if applicable) or download the notebook
2. **Install required packages**:
```bash
pip install -U langchain-mcp-adapters langgraph "langchain[openai]"
```
Or install from requirements.txt:
```bash
pip install -r requirements.txt
```
3. **Set up environment variables** (see Configuration section)
## Configuration
Create a `.env` file in the project directory with the following variables:
```env
AZURE_OPENAI_API_VERSION=2024-02-15-preview
AZURE_OPENAI_ENDPOINT=https://your-resource.openai.azure.com/
AZURE_OPENAI_API_KEY=your-api-key-here
AZURE_OPENAI_CHAT_DEPLOYMENT_NAME=your-deployment-name
```
### Required Azure OpenAI Setup
1. Create an Azure OpenAI resource
2. Deploy a GPT model (GPT-3.5-turbo or GPT-4)
3. Note your endpoint, API key, and deployment name
4. Update the `.env` file with your credentials
## Usage
### Running the Notebook
1. **Open the notebook**: Launch `multiagent.ipynb` in Jupyter Lab/Notebook or VS Code
2. **Execute cells sequentially**:
- Cell 1: Install dependencies
- Cell 2: Import libraries and load environment variables
- Cell 3: Test Azure OpenAI connection
- Cell 4-6: Set up MCP crypto agent
- Cell 7-9: Test crypto agent functionality
- Cell 10-12: Configure document writer agent
- Cell 13: Run the complete multi-agent workflow
3. **Monitor execution**: The supervisor will coordinate tasks and display progress
### Example Workflow
When you run the supervisor, it will:
1. **Receive user request**: "Generate a report on the profitability of investing in bitcoin given the current price"
2. **Delegate to crypto agent**: Fetch current Bitcoin price and market data
3. **Delegate to document writer**: Generate comprehensive investment report
4. **Save output**: Report saved to the `output/` directory
## Output
The system generates:
- **Console output**: Real-time workflow visualization with emojis and agent communications
- **Report file**: Comprehensive Bitcoin investment analysis saved as `.txt` file in the `output/` directory
### Sample Report Structure
```
**Introduction on market landscape**
Current market conditions and Bitcoin position
**Investment Strategy**
Recommended approach based on current data
**Performance Analysis**
Historical performance and market trends
**Recommendations**
Specific investment advice and risk considerations
**Conclusion**
Summary and final thoughts
**References**
Data sources and market information
```
## Key Dependencies
- **langchain-mcp-adapters**: Model Context Protocol integration
- **langgraph**: Agent workflow orchestration
- **langchain[openai]**: LangChain with OpenAI support
- **python-dotenv**: Environment variable management
- **pathlib**: File system operations
## File Structure
```
code/
├── multiagent.ipynb # Main notebook with multi-agent implementation
├── requirements.txt # Python dependencies
├── README.md # This file
├── .env # Environment variables (create this)
└── output/ # Generated reports directory
└── Bitcoin_Investment_Profitability_Report.txt
```
## Extending the Application
### Adding New Agents
1. Create agent with `create_react_agent()`
2. Define specialized tools if needed
3. Add to supervisor's agent list
4. Create handoff tool for the new agent
### Adding New Data Sources
1. Implement MCP client for new API
2. Create specialized tools
3. Integrate with existing agents or create new ones
## License
This project is for educational and demonstration purposes. Please ensure compliance with all API terms of service when using in production.
## References
- **LangChain**: Agent framework and multi-agent orchestration - [https://langchain.com/](https://langchain.com/)
- **LangGraph**: Workflow orchestration for multi-agent systems - [https://langchain-ai.github.io/langgraph/](https://langchain-ai.github.io/langgraph/)
- **CoinGecko MCP**: Cryptocurrency data and market information - [https://mcp.api.coingecko.com/](https://mcp.api.coingecko.com/)
- **Azure OpenAI**: AI model access and deployment - [https://azure.microsoft.com/en-us/products/ai-services/openai-service](https://azure.microsoft.com/en-us/products/ai-services/openai-service)
- **Model Context Protocol (MCP)**: Protocol for AI model context sharing - [https://github.com/modelcontextprotocol](https://github.com/modelcontextprotocol)
Connection Info
You Might Also Like
valuecell
Valuecell is a Python project for efficient data management.
hexstrike-ai
HexStrike AI is an AI-powered MCP cybersecurity automation platform with 150+ tools.
AP2
AP2 provides code samples and demos for the Agent Payments Protocol.
YC-Killer
YC-Killer is an AI agents library by Singularity Research, open-sourcing...
Vibe-Trading
Vibe-Trading: Your Personal Trading Agent
tradingview-mcp
AI-assisted TradingView chart analysis — connect Claude Code to your...