Bake a simple Agent in Sagemaker AI notebook
Описание и применение
Создание простого агента в SageMaker с использованием Strands Agents и Amazon Bedrock, включая инструменты для арифметики и погоды.
Задача
Create an AI agent that can use tools such as arithmetic and weather lookup within an AWS SageMaker notebook using Amazon Bedrock models.
Результат
The notebook demonstrates how to set up a Strands Agents agent in SageMaker, configure Bedrock, and use simple tools for arithmetic and weather data.
Рабочий процесс
- Create a SageMaker notebook instance with default settings.
- Open JupyterLab and create a new notebook named SimpleAgent.ipynb.
- Install strands-agents, boto3, and requests via pip.
- Import os, boto3, Agent, tool, and BedrockModel from strands.
- Configure AWS_REGION, BEDROCK_MODEL_ID, and verify credentials with sts.get_caller_identity().
- Define the calculate and get_weather tools using the @tool decorator.
- Instantiate an Agent with the BedrockModel and the two tools.
- Run the agent on sample queries to see tool selection and responses.
Доказательства
Login to AWS account using an I AM user with admin access
Install strands-agents, boto3, and requests via pip
BedrockModel tells Strands to send model requests to Amazon Bedrock
- Дата записи: 2026-10-14T04:41:19.170Z