A conversational AI agent built with Strands Agents framework and hosted on Amazon Bedrock AgentCore Runtime. This agent provides multiple specialized tools for calculations, weather information, text processing, and unit conversions.
This project demonstrates how to:
- Build an agent using the Strands Agents framework
- Integrate with Amazon Bedrock models (Claude 3 Haiku)
- Deploy and host on Amazon Bedrock AgentCore Runtime
- Create a Streamlit web interface for user interaction
- 📊 Calculator: Mathematical calculations and operations
- 🌤️ Weather: Current weather conditions
- ⏰ Time: Current date and time in IST (GMT+5:30)
- 🔢 Random Number: Generate random numbers within ranges
- 🎨 Random Color: Pick random color names
- 📝 Text Length: Count characters in text strings
- 🔄 Reverse Text: Reverse character order in text
- Python 3.8+
- AWS Account with Bedrock access
- AWS CLI configured with appropriate permissions
- Amazon Bedrock AgentCore Runtime setup
-
Clone the repository
git clone <repository-url> cd Bedrock_AgentCore_Strands_ChatAgent
-
Install dependencies
pip install -r requirements.txt
-
Configure AWS credentials
aws configure
python agents/strands_chatagent.pystreamlit run streamlit_app.pyThe web interface will be available at http://localhost:8501
- Math: "Calculate 15 + 25 * 3"
- Weather: "What's the weather like?"
- Time: "What time is it?"
- Text Processing: "What's the length of 'Hello World'?"
- Random: "Give me a random number between 1 and 100"
Bedrock_AgentCore_Strands_ChatAgent/
├── agents/
│ └── strands_chatagent.py # Main agent implementation
├── tools/
│ ├── __init__.py
│ ├── random_tools.py # Random generation tools
│ ├── text_tools.py # Text processing tools
│ ├── time_tool.py # Time-related tools
│ └── weather.py # Weather information tool
├── streamlit_app.py # Web interface
├── requirements.txt # Python dependencies
└── README.md # This file
Update the agentRuntimeArn in streamlit_app.py with your deployed agent's ARN:
agentRuntimeArn="arn:aws:bedrock-agentcore:us-east-1:YOUR_ACCOUNT:runtime/YOUR_RUNTIME_ID"The agent uses Anthropic Claude 3 Haiku by default. To change the model, update the model_id in agents/strands_chatagent.py:
model_id = "anthropic.claude-3-haiku-20240307-v1:0"-
Package the agent
zip -r agent.zip agents/ tools/ requirements.txt
-
Deploy to Bedrock AgentCore Use the AWS CLI or Console to deploy your agent package to Bedrock AgentCore Runtime.
-
Update the Streamlit app Replace the
agentRuntimeArnwith your deployed agent's ARN.
Test individual tools:
from tools.weather import weather
from tools.time_tool import get_time
from strands_tools import calculator
# Test weather tool
print(weather())
# Test time tool
print(get_time())
# Test calculator
print(calculator("15 + 25"))- Response Time: Typically 1-3 seconds
- Model: Claude 3 Haiku (fast and cost-effective)
- Concurrent Users: Supports multiple simultaneous conversations
- Uses AWS IAM for authentication and authorization
- All communications encrypted in transit
- No sensitive data stored locally
- Tools designed with safety constraints
- Fork the repository
- Create a feature branch
- Add your tools in the
tools/directory - Update the agent configuration
- Test thoroughly
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
-
Agent Runtime Not Found
- Verify the
agentRuntimeArnis correct - Ensure the runtime is deployed and active
- Verify the
-
Permission Denied
- Check AWS credentials and permissions
- Verify Bedrock access is enabled
-
Tool Import Errors
- Ensure all dependencies are installed
- Check Python path configuration
Enable debug logging in the agent:
import logging
logging.basicConfig(level=logging.DEBUG)For issues and questions:
- Check the troubleshooting section
- Review AWS Bedrock AgentCore documentation
- Open an issue in the repository
Built with ❤️ using Strands Agents and Amazon Bedrock AgentCore