|
| 1 | +# GenAI-Powered Financial Advisor |
| 2 | + |
| 3 | +A comprehensive GenAI-powered wealth and financial tools built with **Strands Agents**, **Amazon Bedorck**, and **MCP** designed to automate client meeting analysis, advisor follow-up item analysis, portfolio analysis, market research, and report generation for financial advisors. |
| 4 | + |
| 5 | +## β¨ Key Features |
| 6 | + |
| 7 | +### π Financial Analysis Capabilities |
| 8 | +- **Portfolio Analysis**: Comprehensive portfolio performance tracking and analysis |
| 9 | +- **Stock Market Data**: Real-time stock pricing, historical data, and market trends |
| 10 | +- **Market Research**: Web-based research using Tavily integration |
| 11 | +- **Performance Metrics**: Detailed financial metrics and comparative analysis |
| 12 | + |
| 13 | +### π Client Meeting Management |
| 14 | +- **Meeting Analysis**: AI-powered analysis of client meeting notes and transcripts |
| 15 | +- **Sentiment Analysis**: Customer sentiment assessment with supporting evidence |
| 16 | +- **Action Item Extraction**: Automated identification of follow-up tasks , decisions and find necessary answers |
| 17 | + |
| 18 | +### π Reporting & Documentation |
| 19 | +- **PDF Report Generation**: Professional client reports with charts and analysis |
| 20 | + |
| 21 | +### π€ AI-Powered Chat Interface |
| 22 | +- **Interactive UI**: Streamlit-based interface with example queries and configuration options |
| 23 | + |
| 24 | +## ποΈ Architecture |
| 25 | +Overall architecture in multi-agent collaboration with MCP and tools. |
| 26 | + |
| 27 | + |
| 28 | +Autonomous agents are a current market trend. Complex inquiries will take time to complete. Here is the process flow for financial advisors to complete complex tasks using **Strands Agents Graph pattern** |
| 29 | + |
| 30 | + |
| 31 | + |
| 32 | +### Core Components |
| 33 | + |
| 34 | +``` |
| 35 | +17-genai-powered-financial-advisor-tools/ |
| 36 | +βββ application/ # Main application code |
| 37 | +β βββ app.py # Streamlit web interface |
| 38 | +β βββ chat.py # Core chat logic and agent |
| 39 | +β βββ info.py # Model configuration |
| 40 | +β βββ prompt.py # System prompts for GenAI |
| 41 | +β βββ retrieve_schema.py # pre-load database schema |
| 42 | +β βββ mcp_server_*.py # MCP server implementations |
| 43 | +β βββ prerequisites/ # Setup and configuration |
| 44 | +β βββ athena_database_setup.py |
| 45 | +β βββ bedrock_knowledge_base_setup.py |
| 46 | +β βββ prereqs_config.yaml |
| 47 | +β βββ client_meeting_note.txt |
| 48 | +βββ assets/ # Application assets (fonts, images) |
| 49 | +β βββ AmazonEmber_Lt.ttf |
| 50 | +β βββ architecture_graph.png |
| 51 | +β βββ architecture.png |
| 52 | +βββ outputs/ # Generated reports and charts |
| 53 | +β βββ charts/ # Stock charts and visualizations |
| 54 | +β βββ reports/ # PDF reports and analysis documents |
| 55 | +βββ requirements.txt # Python dependencies |
| 56 | +βββ README.md |
| 57 | +βββ .env.example |
| 58 | +βββ deploy_prereqs.sh |
| 59 | +``` |
| 60 | +### MCP (Model Context Protocol) Servers |
| 61 | + |
| 62 | +The application includes specialized MCP servers for different data sources: |
| 63 | + |
| 64 | +- **Stock Data Server** (`mcp_server_stock.py`): Yahoo Finance API integration for stock data |
| 65 | +- **Athena Server** (`mcp_server_athena.py`): AWS Athena database queries for portfolio data |
| 66 | +- **Tavily Server** (`mcp_server_tavily.py`): Web search capabilities for market research |
| 67 | +- **Knowledge Base List Server** (`mcp_server_kb.py`): Amazon Bedrock Knowledge Bases integration |
| 68 | + |
| 69 | +### Specialized AI Agents |
| 70 | + |
| 71 | +- **Client Meeting Analysis Agent**: Processes meeting notes and extracts insights |
| 72 | +- **Web Search Agent**: Conducts comprehensive web research for financial information |
| 73 | +- **Market Search Agent**: Specialized market research and economic analysis |
| 74 | +- **Database Query Agent**: Retrieves portfolio and client data from databases |
| 75 | +- **Stock Analysis Agent**: Real-time stock data analysis and reporting |
| 76 | +- **Report Generation Agent**: Generate PDF report |
| 77 | + |
| 78 | +## π Quick Start |
| 79 | + |
| 80 | +### Prerequisites |
| 81 | + |
| 82 | +- **Python 3.8+** (Python 3.9+ recommended) |
| 83 | +- **AWS Account** with Bedrock access and appropriate permissions |
| 84 | +- **AWS CLI** configured with credentials |
| 85 | +- **Required AWS Services**: |
| 86 | + - Amazon Bedrock (Claude models v3.7 and v4.0, follow instructions [here](https://docs.aws.amazon.com/bedrock/latest/userguide/model-access-modify.html)) |
| 87 | + - Amazon Bedrock Knowledge Bases (for doucment queries) |
| 88 | + - AWS Athena (for database queries) |
| 89 | + - Amazon S3 (for data storage) |
| 90 | + |
| 91 | +### Installation |
| 92 | + |
| 93 | +1. **Clone and navigate to the GenAI_powered_financial_advisor_tools directory**: |
| 94 | + ```bash |
| 95 | + git clone https://github.com/strands-agents/samples.git |
| 96 | + cd 17-genai-powered-financial-advisor-tools |
| 97 | + ``` |
| 98 | + |
| 99 | +2. **Set up Python virtual environment**: |
| 100 | + ```bash |
| 101 | + python -m venv .venv |
| 102 | + source .venv/bin/activate # On Windows: .venv\Scripts\activate |
| 103 | + ``` |
| 104 | + |
| 105 | +3. **Install dependencies**: |
| 106 | + ```bash |
| 107 | + pip install -r requirements.txt |
| 108 | + ``` |
| 109 | + |
| 110 | +3. **Configure AWS credentials**: |
| 111 | + ```bash |
| 112 | + aws configure |
| 113 | + |
| 114 | + # Or set environment variables: |
| 115 | + |
| 116 | + export AWS_ACCESS_KEY_ID=your_access_key |
| 117 | + export AWS_SECRET_ACCESS_KEY=your_secret_key |
| 118 | + export AWS_DEFAULT_REGION=us-west-2 |
| 119 | + |
| 120 | + ``` |
| 121 | + |
| 122 | +4. **Set up prerequisites**: |
| 123 | + |
| 124 | + This script will create Amazon Bedrock Knowledge Bases. Also, it will create database, tables, and insert sample data using Amazon Athena. |
| 125 | + ```bash |
| 126 | + bash deploy_prereqs.sh |
| 127 | + ``` |
| 128 | + |
| 129 | +6. **Create Tavily API key and add in the .env file**: |
| 130 | + |
| 131 | + Visit [Travily](https://www.tavily.com/) and create API key post sign-up. Update your tavily api key in .env file. This is mandatory required to run the GenAI tools : |
| 132 | + ```bash |
| 133 | + TAVILY_API_KEY="" |
| 134 | + ``` |
| 135 | + |
| 136 | +6. **Start the application**: |
| 137 | + |
| 138 | + Execute the following commands in the "17-genai-powered-financial-advisor-tools" directory |
| 139 | + ```bash |
| 140 | + streamlit run application/app.py |
| 141 | + ``` |
| 142 | + |
| 143 | +7. **Access the application**: |
| 144 | + - Open your browser to `http://localhost:8501` |
| 145 | + - Select your preferred AI model from the sidebar |
| 146 | + - Start interacting with the Financial Advisor AI |
| 147 | + |
| 148 | +## π§ Configuration |
| 149 | + |
| 150 | +### Prerequisites Configuration |
| 151 | + |
| 152 | +The null fields will be automatically updated when you run deploy_prereqs.sh file |
| 153 | +`application/prerequisites/prereqs_config.yaml`: |
| 154 | + |
| 155 | +```yaml |
| 156 | +database_name: null |
| 157 | +knowledge_base_description: financial advisor |
| 158 | +knowledge_base_id: null |
| 159 | +knowledge_base_name: null |
| 160 | +project_name: financial-advisor |
| 161 | +project_short_name: fa |
| 162 | +region_name: us-west-2 |
| 163 | +s3_bucket_name_for_athena: null |
| 164 | +s3_bucket_name_for_kb: null |
| 165 | +
|
| 166 | +``` |
| 167 | + |
| 168 | +## π‘ Usage Examples |
| 169 | + |
| 170 | +### Portfolio Analysis |
| 171 | +``` |
| 172 | +"Michael Chen's Portfolio Summary" |
| 173 | +``` |
| 174 | +Retrieves comprehensive portfolio information including holdings, performance metrics, and analysis. |
| 175 | +
|
| 176 | +### Stock Market Research |
| 177 | +``` |
| 178 | +"Amazon stock pricing today" |
| 179 | +"Compare Amazon and Microsoft stock performance over the last year" |
| 180 | +"The prospects for the US stock market for remaining 2025" |
| 181 | +``` |
| 182 | +
|
| 183 | +### Client Meeting Analysis |
| 184 | +``` |
| 185 | +"client meeting summary of knowledge base ID kb-12345" (your knowledge base id) |
| 186 | +"using knowledge base Financial advisor Sarah Johnson, Provide a complete customer report" |
| 187 | +``` |
| 188 | +
|
| 189 | +### Market Research |
| 190 | +``` |
| 191 | +"Latest trends in renewable energy investments" |
| 192 | +"Federal Reserve interest rate impact on tech stocks" |
| 193 | +``` |
| 194 | +
|
| 195 | +## π Dependencies |
| 196 | +
|
| 197 | +### Core Dependencies |
| 198 | +- **strands-agents**: AI agent framework |
| 199 | +- **streamlit**: Web interface framework |
| 200 | +- **boto3**: AWS SDK for Python |
| 201 | +- **pandas**: Data manipulation and analysis |
| 202 | +- **matplotlib**: Plotting and visualization |
| 203 | +- **reportlab**: PDF generation |
| 204 | +- **yfinance**: Stock market data |
| 205 | +- **tavily-python**: Web search capabilities |
| 206 | +- **mcp**: Model Context Protocol implementation |
| 207 | +
|
| 208 | +
|
| 209 | +
|
| 210 | +7. **Access the application**: |
| 211 | + - Open your browser to `http://localhost:8501` (Check "7. Start the application" in the above instruction) |
| 212 | + - Select your preferred AI model from the sidebar |
| 213 | + - Start interacting with the Financial Advisor AI |
| 214 | +
|
| 215 | +## π§ Cleanup |
| 216 | +
|
| 217 | +Clean up created resources by executing the scripts in the application/prerequisites/ directory: |
| 218 | +
|
| 219 | +```yaml |
| 220 | +#Delete knowledge base relavent resources |
| 221 | +python bedrock_knowledge_base_setup.py --mode delete |
| 222 | +
|
| 223 | +#Delete database relavent resources |
| 224 | +python athena_database_setup.py --mode delete |
| 225 | +``` |
| 226 | + |
| 227 | +## π License |
| 228 | + |
| 229 | +This project is licensed under the MIT No Attribution License - see the [LICENSE](LICENSE) file for details. |
| 230 | + |
| 231 | +## π€ Contributing |
| 232 | + |
| 233 | +Contributions are welcome! Please: |
| 234 | + |
| 235 | +1. Fork the repository |
| 236 | +2. Create a feature branch |
| 237 | +3. Add comprehensive tests |
| 238 | +4. Update documentation |
| 239 | +5. Submit a pull request |
| 240 | + |
| 241 | +## π Support |
| 242 | + |
| 243 | +For support and questions: |
| 244 | + |
| 245 | +1. **Review your permission** on AWS |
| 246 | +2. **Tavily API KEY** is added on .env file |
| 247 | +3. **Verify model access** in Bedrock console |
| 248 | +4. **Test basic functionality** with simple queries |
| 249 | +5. **Check application logs** for detailed error information |
| 250 | + |
| 251 | +## π Related Resources |
| 252 | + |
| 253 | +- [Strands Agents Documentation](https://strandsagents.com/) |
| 254 | +- [AWS Bedrock Documentation](https://docs.aws.amazon.com/bedrock/) |
| 255 | +- [Amazon Bedrock Knowledge Bases](https://docs.aws.amazon.com/bedrock/latest/userguide/knowledge-base.html) |
| 256 | +- [Streamlit Documentation](https://docs.streamlit.io/) |
| 257 | + |
| 258 | +--- |
| 259 | + |
| 260 | +**Transform your financial advisory practice with AI-powered insights and automation! π** |
0 commit comments