Amazon Bedrock Deep Dive · lab exercise

Exercise 6: your Strands agent on Amazon Bedrock AgentCore Runtime

Part of Amazon Bedrock Deep Dive (BDR-101), with lesson 6-2. You do this in your own AWS account; Gazeek gives no AWS access.

Cost: a few cents at most (Runtime bills per second; two short model calls on Nova Micro). The cleanup at the end is part of the exercise: do it, and check it, or a KMS key and a few small things stay behind.

Before you start

  • Node.js 20.12 or later, Python 3.10 or later, and uv.
  • AWS credentials for an account and Region with AgentCore (us-east-1 or us-west-2 have every feature).
  • If you ever installed the old Python toolkit, remove it: pip uninstall bedrock-agentcore-starter-toolkit. It also installs an agentcore command and can shadow the new one.

Steps

  1. Install the AgentCore CLI (checked with 1.3.0) and, if you like, turn its telemetry off:

    npm install -g @aws/agentcore
    agentcore config telemetry.enabled false
    
  2. Create a Strands project. Give the template: in CLI 1.3.0 the default template is empty.

    agentcore create --name MyAgent --template agent-python-strands
    cd MyAgent
    

    You get app/agent/main.py (a Strands agent with a sample add_numbers tool, wrapped in BedrockAgentCoreApp), app/agent/model/load.py (the model), and agentcore/agentcore.json (a runtime and an AgentCore Memory resource).

  3. Name a cheap model with a token cap. In app/agent/model/load.py:

    return BedrockModel(model_id="amazon.nova-micro-v1:0", region_name="us-east-1", max_tokens=1024)
    

    (The template's default is a Claude model; it works, and costs more.)

  4. Try it locally if you like: agentcore dev.

  5. Deploy (about five minutes the first time: it bootstraps the AWS CDK in your account and turns on CloudWatch Transaction Search):

    agentcore deploy --region us-east-1
    
  6. The agent call:

    agentcore invoke --runtime agent --payload '{"prompt":"In one sentence, what is Amazon Bedrock AgentCore? Then add 19 and 23."}'
    

What you should see

A stream of events (contentBlockDelta pieces of text, then messageStop and token metadata), ending with status=200 and a runtime-session-id. Gazeek's test run, 27 Nov 2026, assembled:

tools: ['add_numbers']
The sum of 19 and 23 is 42.
Regarding Amazon Bedrock AgentCore, I do not have information on that specific resource, …

The agent used its tool for the sum, and the small model honestly didn't know what AgentCore is: a good reminder that an agent knows only what its model and tools give it.

Clean up, and check

  1. Remove the project's resources, then deploy the now-empty project, which deletes its stack:

    agentcore remove all --yes
    agentcore deploy --yes --region us-east-1
    
  2. That is not everything. Gazeek's test found these left in the account afterwards:

    • the CDKToolkit stack (from the CDK bootstrap), with an S3 bucket, an ECR repository, IAM roles and a KMS key (about $1 a month while it exists);
    • the runtime's CloudWatch log group /aws/bedrock-agentcore/runtimes/<name>-DEFAULT;
    • CloudWatch Transaction Search switched on, with an aws/spans log group (no cost without traffic).

    If you don't use the CDK for anything else in that Region, remove the bootstrap too:

    aws logs delete-log-group --log-group-name /aws/bedrock-agentcore/runtimes/<name>-DEFAULT
    # empty the bootstrap bucket (all object versions), then:
    aws cloudformation delete-stack --stack-name CDKToolkit
    aws s3api delete-bucket --bucket cdk-hnb659fds-assets-<account>-<region>   # kept by the stack's retain policy
    

    Deleting the stack schedules the KMS key for deletion (30 days).

  3. Check: aws bedrock-agentcore-control list-agent-runtimes and list-memories are empty, and aws cloudformation list-stacks shows nothing of yours.

What you learned

The same Strands agent, wrapped with BedrockAgentCoreApp, deployed with agentcore deploy, called with agentcore invoke, each session in its own microVM, and a cleanup you check rather than trust.

← Back to Amazon Bedrock Deep Dive