A travel assistant application built with AWS Bedrock AgentCore and MongoDB Atlas integration, providing comprehensive travel information and recommendations.
This project demonstrates a modern AI-powered travel assistant that leverages:
- AWS Bedrock AgentCore for intelligent agent orchestration
- MongoDB Atlas for travel data storage and retrieval
- Streamlit for interactive web interface
- Docker for containerized deployment
The agent provides detailed travel information including destinations, activities, cultural insights, and practical travel advice with graceful fallback when database access is unavailable.
mdb_strands_agentcore/
├── agent.py # Core agent logic and MongoDB integration
├── app.py # Direct API testing interface
├── streamlit_app.py # Streamlit web interface
├── deploy.py # AWS deployment script with IAM configuration
├── requirements.txt # Python dependencies
├── venv/ # Python virtual environment
└── README.md # This file
- Intelligent Travel Recommendations: Provides comprehensive travel advice for destinations worldwide
- MongoDB Atlas Integration: Stores and retrieves travel data with graceful fallback
- Multi-Interface Support: Both direct API and Streamlit web interface
- Robust Error Handling: Continues to provide valuable responses even when data sources are unavailable
- AWS Integration: Full deployment pipeline with proper IAM permissions
- Containerized Deployment: Docker support for consistent environments
- Python 3.12+
- AWS CLI configured with appropriate permissions
- MongoDB Atlas account
- Docker (for containerized deployment)
-
Clone the repository:
git clone https://github.com/mongodb-partners/Bedrock-AgentCore-Atlas-Travel-App.git
-
Set up virtual environment:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install dependencies:
pip install -r requirements.txt
-
Configure AWS credentials:
aws configure
Test the agent directly using the command-line interface:
source venv/bin/activate
python app.py
This will run a test query and display the agent's response with debug information.
Launch the interactive web interface:
source venv/bin/activate
streamlit run streamlit_app.py
Navigate to http://localhost:8501
to interact with the travel assistant through a user-friendly web interface.
Important: Replace <AGENT-ARN>
in the code with your actual Bedrock AgentCore ARN.
After running python deploy.py
, use the ARN from the output in:
app.py
: Update theagentRuntimeArn
parameterstreamlit_app.py
: Update the agent ARN reference
Example:
agentRuntimeArn="arn:aws:bedrock-agentcore:us-east-1:123456789:runtime/agentcore_name-id"
Deploy the agent to AWS using the deployment script:
source venv/bin/activate
python deploy.py
The deployment script:
- Creates necessary IAM roles and policies
- Configures Secrets Manager access for MongoDB credentials
- Deploys the agent to Bedrock AgentCore
- Sets up proper permissions for all AWS services
-
Agent Core (
agent.py
):- Handles travel queries and recommendations
- Integrates with MongoDB Atlas for data retrieval
- Implements graceful fallback mechanisms
-
Simple Test App (
app.py
):- Direct API testing and debugging
- Response extraction and formatting
- Dynamic agent ARN lookup from configuration
-
Web Interface (
streamlit_app.py
):- User-friendly chat interface
- Real-time agent interaction
- Response parsing and display
-
Deployment (
deploy.py
):- AWS resource provisioning
- IAM role and policy management
- Secrets Manager integration
User Query → Streamlit/API → Bedrock AgentCore → Agent Logic → MongoDB Atlas
↓
User Interface ← Response Processing ← Agent Response ← Travel Data/Fallback
-
400 Bad Request Errors:
- Check input parameter formatting in agent calls
- Verify agent ARN is correctly configured
-
AccessDeniedException for Secrets Manager:
- Ensure IAM role has
secretsmanager:GetSecretValue
permission - Verify the secret exists and is accessible
- Ensure IAM role has
-
MongoDB Connection Issues:
- Agent provides comprehensive fallback responses
- Verify MongoDB Atlas credentials in Secrets Manager
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly using both interfaces
- Submit a pull request
[Add your license information here]
For issues and questions:
- Check the troubleshooting section above
- Review CloudWatch logs for detailed error information
- Ensure all AWS permissions are properly configured
Note: This project demonstrates advanced AWS Bedrock AgentCore integration with MongoDB Atlas, showcasing modern AI application architecture with robust error handling and multiple interface options.