![[Update] Strands Box Is Now Available in Amazon Bedrock AgentCore Runtime! #AWSreInvent](https://devio2024-media.developers.io/image/upload/f_auto,q_auto/c_limit,w_1200/v1796065643/eyecatch/dlg5ttmg1mm8clcwzkmp.png)
[Update] Strands Box Is Now Available in Amazon Bedrock AgentCore Runtime! #AWSreInvent
This page has been translated by machine translation. View original
Introduction
Hello, I'm Kanno from the Consulting Department.
I'm at re:Invent right now, and I was listening to the Keynote!
In today's update, Amazon Bedrock AgentCore Runtime now supports Strands Box, which runs agents inside a sandbox!
Until now you had to build things yourself and prepare the stack, but from now on the AgentCore CLI alone can create the Runtime and even the Gateway for controlling communication!
I'll summarize the main changes and try following the official steps through to deploying to the Runtime!
I've tried Strands Box itself before, and I introduced how it works in the article below, so please refer to it as well!
Main Changes
Agents with Box can be deployed with the CLI
The official Strands sample has you build Box from source in a Linux ARM64 environment,
place the package in S3, and prepare the stack yourself.
From now on, you just create a project with the Box template of the AgentCore CLI and run agentcore deploy, and it can create the Runtime and even the Gateway that serves as the exit for outbound communication!
The image is built with AWS CodeBuild, so I was able to deploy even from a Mac without preparing a Linux ARM64 environment.

Note that in the AgentCore documentation, support for Strands Box is in preview.
Box evaluates communication and it exits via the Gateway
The deployed architecture looks like this.

Each Runtime session runs in its own dedicated microVM, and inside it Box confines the agent.
When the agent communicates externally, Box evaluates it against the policy, and only what is permitted goes out through the Gateway for Box.
The hosts to allow are written in Box's profile (profile.toml), and at build time the CLI converts them into Gateway targets. Calls to Bedrock are signed with the Gateway's IAM role, so the agent itself doesn't hold AWS credentials.
The template also included, from the start, a policy that prohibits connections to the instance metadata that returns the execution role's credentials. This policy is written in Dogwood, which I used before with AgentCore Policy's Temporal Policies.
Each permit/deny decision is recorded one by one as a CloudWatch Logs record in the Runtime's log group.
It can also be placed in a VPC with no route to the internet
If you add --containment private-vpc to agentcore create, the Runtime is configured to run inside a VPC with no route to the internet. When I tried only creating it, the CLI displayed an estimated monthly cost.
containment: private VPC with no internet path · about $58/month while deployed for CodeZip, $88 for a container, more with 3 AZs · the VPC is kept after the stack is deleted and counts toward the account's VPC quota until you delete it
The container type costs about $88 per month, so it's quite expensive.
This time I'll deploy with the default contained.
Prerequisites
| Item | Details |
|---|---|
| AgentCore CLI | 1.5.0 |
| Strands Box | 0.3.3 |
| Local PC | macOS 26.6.2(Apple silicon) |
| Region | us-east-1 |
| Model | Claude Sonnet 5.5(template default) |
Box projects run on Runtime platform version V2, so choose a region that supports V2. The Tokyo region is also supported.
The CLI reads the profile with the box command during build and deploy, so install Box as well.
pnpm add -g @aws/agentcore@1.5.0
brew install --cask strands-agents/tap/box
Trying It Out
The official documentation also has you create Box projects with the AgentCore CLI, so I'll proceed with the CLI this time too.
Create the project
Specify the Box template and create the project.
agentcore create --name MyBoxProject --template agent-python-strands-box-container
cd MyBoxProject
The created Box profile contained a setting to sign calls to Bedrock with AWS credentials and a specification of the policy file that prohibits connections to the metadata.
packs = ["@box/base", "@box/bedrock"]
policies = ["aws-metadata-block.dw"]
[egress.bedrock]
secret.ref = "aws://"
In the Dockerfile, box run is the container's entry point, and Box passes requests it receives on port 8080 to the agent inside (port 8081).
ENTRYPOINT ["/opt/box/box", "run", "/home/bedrock_agentcore/box-profile/profile.toml", "--no-banner"]
Add a tool to fetch external sites
As in the official steps, add a tool that fetches either GitHub or example.com after tools.append(add_numbers) in app/agent/main.py.
Tool added to app/agent/main.py
SITES = {
"github": "https://api.github.com/zen",
"example": "https://example.com",
}
@tool
def fetch_site(site: str) -> str:
"""Fetch the first 500 characters from a known site. The site is "github" or "example"."""
import urllib.request
url = SITES.get(site)
if url is None:
return f"UNKNOWN SITE: {site}"
try:
with urllib.request.urlopen(url, timeout=10) as r:
return r.read(500).decode("utf-8", "replace")
except Exception as e:
return f"FETCH FAILED: {type(e).__name__}: {e}"
tools.append(fetch_site)
Add the allowed host
Add api.github.com to the end of the profile.
[egress.github]
destinations = ["api.github.com"]
When I built, the added host was registered as the Gateway target egress-github.
agentcore build
adding gateway target 'egress-github' to 'agent-box-egress' for api.github.com
adding target 'bedrock' to gateway 'agent-box-egress' in agentcore.json, for the boxed agent's model calls
It's nice that it creates Gateway targets from the hosts written in the profile without me having to write them myself.
When removing a host, you just fix the profile and rebuild.
Deploy and invoke
agentcore deploy
The first time, the image is built with CodeBuild, so it took about 7 minutes for the deployment to finish. Running agentcore status shows that two targets, one for Bedrock and one for GitHub, are deployed on the Gateway.
{
"resourceType": "gateway",
"name": "agent-box-egress",
"children": [
{ "resourceType": "gateway-target", "name": "egress-github", "deploymentState": "deployed" },
{ "resourceType": "gateway-target", "name": "bedrock", "deploymentState": "deployed" }
],
"deploymentState": "deployed"
}
I ask it to fetch the allowed GitHub and the non-allowed example.com in succession.
agentcore invoke --runtime agent \
--payload '{"prompt":"Use fetch_site with the site github and tell me what it returned. Then use fetch_site with the site example and tell me what happened."}'
I made both calls.
1. **github**: The call worked. It returned the text "It's not fully shipped until it's fast."
2. **example**: The call failed. It returned `FETCH FAILED: URLError: <urlopen error Tunnel connection failed: 403 Forbidden>`. The proxy tunnel refused the connection with a 403 Forbidden error, so I got no content from that site.
A short phrase came back from GitHub, and example.com was rejected with a 403!
Look at the decision logs
Search the Runtime logs for the deny record.
agentcore logs runtime --since 15m --query '"deny"'
"strands.box.policy.action": "net:connect",
"strands.box.policy.resource": "example.com:443",
"strands.box.policy.verdict": "deny",
"strands.box.policy.cause": "no_match",
"strands.box.policy.reason": "no permit matched",
"strands.box.policy.rule": "<default-deny>"
It matched no rule and was rejected at the connection (net:connect) stage.
Formatting everything, including permit records, into one line each, this invocation was evaluated as follows.
permit net:connect bedrock-runtime.us-east-1.amazonaws.com:443 route_bedrock-api-key_connect
permit http:request bedrock-runtime.us-east-1.amazonaws.com:443/model/global.anthropic.claude-sonnet-5-5/converse-stream route_bedrock-api-key_request
deny net:connect example.com:443 <default-deny>
permit net:connect api.github.com:443 route_github_connect
permit http:request api.github.com:443/zen route_github_request
The name github written in the profile appears in the rule names (route_github_connect), so it's easy to trace which setting allowed it through.
Command used to format the decision records
agentcore logs runtime --since 20m --query '"strands.box.policy.decision"' \
| cut -d' ' -f3- \
| jq -r 'select(.eventName == "strands.box.policy.decision") | .attributes
| [.["strands.box.policy.verdict"], .["strands.box.policy.action"],
.["strands.box.policy.resource"], .["strands.box.policy.rule"]] | @tsv'
Cleanup
agentcore remove all --yes
agentcore deploy --yes
The log groups for the Runtime and CodeBuild are outside the stack, so they remain. The log group of the Lambda that kicks off the image build also remains without being deleted, so check using the cleanup steps in the official documentation and delete them.
aws logs delete-log-group --log-group-name /aws/bedrock-agentcore/runtimes/<RuntimeのID>-DEFAULT
aws logs delete-log-group --log-group-name /aws/codebuild/<CodeBuildのプロジェクト名>
Conclusion
I tried using Strands Box with AgentCore Runtime! I may use it in the future when I want to build governance-minded agents! I'd like to write a blog post when I actually use or operate it!
I hope this article was of some help. Thank you for reading to the end!




