Wednesday, December 2, 2026 Edition No. 256
Search
Review Human-led, AI-assisted · Agent Framework · 23 min read

Strands Box on AgentCore Runtime: Hands-On with a Policy That Follows the Agent to the Cloud

By Fabio Douek

Human-led, AI-assisted. Research and implementation done with AI tools, led, tested and edited by me. How posts are labeled

Jump to section
Explain (TLDR) like I am...
What is this?

Imagine a robot helper that lives in a playroom with a grown-up at the door. Every time the robot wants to open a drawer, use a tool or call someone on the phone, it has to ask the grown-up, who checks a list of house rules and says yes or no.

The new part is that the same grown-up and the same list now travel with the robot when it goes to a friend's house in the cloud. The rules can even remember things, like "you already called three times, that is enough for now".

Treat this as a control that sits outside the agent rather than a promise the agent makes. Each file access, command and outbound request is checked against a written policy, and each allow or deny is recorded in CloudWatch Logs in the customer's own account.

The diligence points are scope and maturity. Box is open source under Apache 2.0 and still a developer preview, its file rules cover only the commands its own interpreters run, and the gateway's logs can hold prompts and completions for 90 days unless that setting is turned off.

The condition is an agent that acts on its own: it reads files, runs commands and calls APIs with nobody approving each step. The intervention is a sandbox plus a policy check on every action, now available in the managed AgentCore runtime, with the same policy file used on a laptop.

In my trial the policy behaved the same locally and in the cloud for commands, private files and unknown hosts, and a rate limit held when calls came one at a time. Side effects: a burst of parallel calls can slip past a count, and the cloud agent starts in an empty working folder.

Notice how much tension sits in letting an agent run without asking for approval at every step. Today that trust is often a feeling. Box turns it into a short file of rules that the whole team can read and argue about.

The relief is that the agent no longer has to remember the rules itself, and that every refusal leaves a record. The new work is agreeing what the rules should be, because the default is to refuse everything, and someone has to own the list of what is allowed.

Think of Box as a stage manager standing between the band and the venue. The agent plays whatever it wants inside the room, but every time it reaches for the door, a cable or the phone, the stage manager checks the rider before letting it through.

The new trick is that the stage manager tours with the band: the rider you rehearse with on a laptop is the one used in the cloud hall. It even keeps count, so the third encore is fine and the fourth is not.

The story is "write the rules once, run them everywhere". Teams test an agent on a laptop under a policy and deploy the same policy to a managed runtime with a few commands, without packaging a sandbox themselves.

Position it for teams that want agents to run unattended but need a record of what each one was allowed to do. Keep the pitch honest: it is a developer preview, and the policy covers commands, files and requests that pass through Box, not everything an agent could ever touch.

Level 100 · How it works

Level 200 · Walkthrough

Level 100 · How it works

Overview

Strands Box is an open-source sandbox for AI agents, Apache 2.0, in developer preview since October 7, 2026. It puts the agent in an operating-system sandbox and checks each thing the agent tries to do (a file it reads, a command it runs, a request it sends, an MCP tool it calls) against a policy written in Dogwood, a policy language derived from Cedar. On December 1, 2026, AWS announced that Amazon Bedrock AgentCore Runtime supports it: “Until now, running Strands Box in the cloud meant packaging it yourself and setting up the AWS resources by hand.” The AgentCore CLI now creates an agent project that runs in a Box from the start, runs it locally under the same policy it will use in production, and deploys it.

It is for teams that want an agent to work without a human approving each step, in what the Box announcement calls “YOLO mode”, and still decide what it may touch. AWS’s own example is an agent investigating a production incident: it may read logs and post to Slack, but no more than three times every ten minutes, and it must not change the infrastructure.

This level is an explainer, written from the announcement, the Box repository and documentation, and the files the AgentCore CLI generates. The hands-on runs are in Level 200.

Architecture

CALLER agentcore invoke, an app optional: a VPC with no internet route (private-vpc) AGENTCORE RUNTIME · ONE MICROVM PER SESSION The agent (Strands) in an OS sandbox; its own files only where the profile grants them STRANDS BOX, OUTSIDE THE SANDBOX Shell Python MCP broker Egress gateway Dogwood policy engine allow or deny each action, with the history of earlier ones allowed AgentCore Gateway adds credentials from AgentCore Identity, or signs with the role OUTSIDE Amazon Bedrock the model calls Allowed hosts APIs, MCP servers CloudWatch Logs: every allow and deny

How It Works

Two layers: a sandbox, then a policy

Box has two layers, in the words of the Box announcement: containment and policy. Containment is the operating system’s sandbox (Seatbelt on macOS), which sets what the agent’s process can reach at all: the folders the profile grants it, and nothing else. Within that boundary, the policy decides each action.

On AgentCore Runtime there is a third layer under both. Each session runs in its own microVM, so one user’s session can’t see another’s. Box then runs inside that microVM, between the agent and everything else.

Every action becomes a decision

Box enforces the policy at four points, and they all run in Box’s own process, outside the sandbox:

Enforcement pointWhat it sees
Shell (Strands Shell)each command the agent runs as bash, and each file that command touches
Python (Monty)the file operations of Python code the agent runs as python3 (its requests go through the egress gateway)
MCP brokereach MCP tool call
Egress gatewayevery outbound connection and HTTP request, from any program in the box

Each point turns what it sees into the same kind of event, whatever tool caused it: a file read is fs:read whether cat or a Python script did it, and a request is http:request whether it came from curl or Python. The other actions are fs:write, fs:delete, fs:move, net:connect, shell:exec, shell:spawn, websocket:connect and mcp:call. A Dogwood rule permits or forbids one of them, under conditions on its fields: a path, a host, a method, a program name. Anything no rule permits is refused, and a forbid wins over every permit. A rule that stops deletes looks like this:

@id("no_deletes")
forbid (principal, action == Box::Action::"fs:delete", resource);

Because the Shell resolves a command before running it, rm -rf build/ becomes one fs:delete decision per file, and that rule stops it before anything is deleted.

Rules that remember

Dogwood’s addition to Cedar is a when temporal { ... } block that looks at the history of earlier events: formerly within 10m (...), counts, sums and the order of actions, with a window of up to 24 hours by default. That is how a rule says “at most three requests to this host in ten minutes”, “run the tests before you commit”, or “no outbound request after reading the customer-data folder”. The agent doesn’t have to remember the limit; Box keeps the history.

Credentials stay outside the agent

Box’s egress gateway sits in the path of every request, so it can add credentials that the agent never sees: for an API-key route, the agent gets a placeholder and the gateway swaps in the real key for a request the policy allows. On AgentCore Runtime, allowed requests then go through an AgentCore Gateway, which takes tool credentials from AgentCore Identity, “so the agent never holds them”, or signs AWS calls, such as the model calls, with its own IAM role. The template also blocks the instance metadata service, which serves the role’s credentials, with its own policy file:

@id("aws_metadata_addresses")
forbid (principal, action == Box::Action::"net:connect", resource)
when {
  (context.input has ip4 && context.input.ip4 == "169.254.169.254") ||
  (context.input has ip6 && context.input.ip6 == "fd00:ec2::254")
};

From a laptop to the runtime

The AgentCore CLI has templates that run in a Box, such as agent-python-strands-box and agent-python-langchain-box, and a --containment choice: contained (in a Box, out only through its Box gateway) or private-vpc (also in a VPC with no internet path). A project holds a Box profile, .box/agent/local/profile.toml, which lists the policy files. agentcore dev runs the agent locally inside box run with that profile, and agentcore deploy copies the same policy files beside the runtime’s profile. The policy you test is the policy you ship.

Every decision is logged

On the runtime, Box sends its records to the runtime’s CloudWatch log group, in the otel-rt-logs stream: the action, the resource, the verdict and the rule that decided it. Locally, box runs history shows the same.

What Box Doesn’t Cover

LimitWhat it means
Developer previewBox is at 0.3.x, and its README calls the box CLI a preview.
File rules cover the Shell and Python onlyThe agent’s own file tools, and paths granted to it directly in the profile, are bounded by the sandbox, not decided by the policy, and don’t enter its history.
A count can be overrun by a burstA count-based limit counts responses. Requests started together are all checked before any has a response, so a burst can exceed the limit by its size (Box’s docs say so; Level 200 shows it).
A wider trusted baseThe interpreters and the broker run outside the sandbox, because they are the code that enforces the policy. AWS calls this a deliberate trade-off.
Not AgentCore PolicyAgentCore Policy governs tool calls through an AgentCore Gateway, in Cedar or Dogwood. Box’s policy governs what the agent does inside its runtime: commands, files and every outbound request. They are separate systems.

Verdict

Box on AgentCore Runtime closes a gap: a policy that decides every command, file access and request, outside the agent, and that you can write and test on a laptop before the same file runs in a managed microVM. The pieces were there before (Box since October, the runtime since 2025); what is new is that the CLI wires them together, with the gateway holding the credentials and CloudWatch holding the decisions.

Where it fits. Agents that run code and call APIs without a human approving each step: incident investigation, data analysis, coding agents. The temporal rules are the strong part: limits and orderings that hold however many turns the agent takes.

What to watch. It is a developer preview. The policy only sees what passes through Box’s enforcement points, the default is to refuse everything (so the first policy takes some writing), and a count is not a hard cap under parallel calls. Level 200 tries all of this for real.

Level 200 · Walkthrough

Overview

This walkthrough creates a boxed Strands agent with the AgentCore CLI, gives it a shell tool, runs it on my laptop under a policy I wrote, then deploys the same project to AgentCore Runtime in us-west-2 and sends it the same prompts. You’ll see every command with its real output, the rule that allowed or refused each action, and the decisions in CloudWatch. What Box is and its limits are in Level 100.

Setup

I used the AgentCore CLI 1.5.0 and Box 0.3.3 on an Apple silicon Mac, with my default AWS profile. Two things in my account changed the plan. The template’s default model, Claude Sonnet 5.5 (global.anthropic.claude-sonnet-5-5), answered “not available for this account”, so I switched to Claude Haiku 4.5 in agentcore/agentcore.json and app/agent/model/load.py (the template’s README says to change both together). And in us-east-1 the CDK bootstrap failed on an old CloudFormation hook in my account that refuses ECR repositories, which has nothing to do with AgentCore, so I deployed to us-west-2.

The Demo: One Agent, One Policy, Laptop and Cloud

Step 1: Create the project

agentcore create --name opsagent --template agent-python-strands-box --region us-west-2

It installs the CDK and Python dependencies, writes the Box files and prints two warnings worth reading:

⚠ runtime "agent": when .box/agent/local/profile.toml has no cloudwatch_logs target, box on AgentCore Runtime sends its
 deny, permit, and trace records to the log group of the runtime, /aws/bedrock-agentcore/runtimes/<runtime ID>-DEFAULT, log
 stream otel-rt-logs. The Runtime makes that log group, so its retention applies, and the log group stays after the runtime
 is removed. CloudWatch Logs charges for the records. ...
⚠ the Box gateway 'agent-box-egress' sends its APPLICATION_LOGS to CloudWatch Logs, which keeps them for 90 days. They can
 hold the request and response bodies of its calls, prompts and completions included. To stop them, set
 "enableApplicationLogs": false on that gateway in agentcore/agentcore.json
created project 'opsagent' in ./opsagent

The second one matters for anyone whose prompts hold customer data: the gateway logs can keep them for 90 days.

Step 2: What the template writes

The Box part of the project is two files in .box/agent/local/. The profile, without its comments:

packs = ["@box/base", "@box/bedrock"]
policies = ["aws-metadata-block.dw"]
[profile]
name = "opsagent-agent"
[project]
access = "write"
[options]
bedrock.region = "us-west-2"
[agent]
command = ["${{ workspace }}/.venv/bin/python", "-m", "uvicorn", "main:app", ...]
...
[[agent.ingress]]
listen = "127.0.0.1:8080"
workload_port = 8081
[egress.bedrock]
secret.ref = "aws://"

The agent gets write access to its own folder (app/agent), one route out, to Bedrock, signed with my AWS credentials by Box rather than by the agent, and one policy file, aws-metadata-block.dw, the metadata-service block shown in Level 100. The agent itself is a Strands agent with one tool, add_numbers. To have something for the policy to decide, I gave it a shell tool that runs bash -c <command>, and passed each tool’s result back in the response stream. A small script of mine, ask, calls agentcore invoke and prints each shell command, what came back and the agent’s answer.

Step 3: First run: everything is refused

agentcore dev > dev.log 2>&1 &
../ask --local 'Run: cat data/load.txt and tell me which host is busiest.'
  shell$ cat data/load.txt
    exit=126
    strands-shell: cat: effect denied: policy denied this operation on 'cat' [default-deny]: No permit policy matched this request.

The template’s only policy file forbids the metadata service and permits nothing, so the agent’s shell can’t run a single command. That is the safe default, and it means the first thing you write is a policy.

Step 4: A policy of my own

policy.dw, beside the profile:

// The commands the agent's shell may run.
@id("shell_commands")
permit (principal, action == Box::Action::"shell:exec", resource)
when { ["ls", "cat", "head", "grep", "wc", "curl", "rm"].contains(context.input.program) };

@id("dev_null")
permit (principal, action in [Box::Action::"fs:read", Box::Action::"fs:write"], resource)
when { context.input.path == "/dev/null" };

// Nothing gets deleted, even inside the project.
@id("no_deletes")
forbid (principal, action == Box::Action::"fs:delete", resource);

I added it to the profile’s policies list, and gave the agent one public host with a route:

policies = ["aws-metadata-block.dw", "policy.dw"]

[egress.github]
destinations = ["api.github.com"]

A route writes the net:connect and http:request permits for its host, so no network rule is needed. Box reads the profile when it starts, so I restarted agentcore dev.

Step 5: Allowed and refused, on my laptop

Five prompts, each one invocation:

$ ../ask --local 'Run: cat data/load.txt and tell me which host is busiest.'
  shell$ cat data/load.txt
    exit=0
    web-01 cpu 91%
    web-02 cpu 34%
    db-01 cpu 12%
$ ../ask --local 'Run: cat ~/.ssh/id_rsa'
  shell$ cat ~/.ssh/id_rsa
    exit=1
    strands-shell: cat: policy denied this operation on '~/.ssh/id_rsa' [default-deny]: No permit policy matched this request.
$ ../ask --local 'Fetch https://example.com with curl -s.'
  shell$ curl -s https://example.com
    exit=1
    curl: policy denied this operation on 'example.com:443' [default-deny]: No permit policy matched this request.
$ ../ask --local 'Run exactly: curl -s -A demo https://api.github.com/zen'
  shell$ curl -s -A demo https://api.github.com/zen
    exit=0
    Accessible for all.
$ ../ask --local 'Clean up: rm data/load.txt'
  shell$ rm data/load.txt
    exit=1
    rm: data/load.txt: policy denied this operation on '/private/tmp/acbox/opsagent/app/agent/data/load.txt' [policy: no_deletes].
ActionResultDecided by
Read a file in the projectallowedthe project permit Box writes from [project] access
Read ~/.ssh/id_rsarefusedno permit (default-deny)
curl to example.comrefusedno route, no permit
curl to api.github.comallowedthe github route
rm a file in the projectrefusedno_deletes, a forbid that wins over the project permit

The refusal is the command’s own error, so the agent reads it like any other failure and reports it. The model never had to agree to anything.

Step 6: A rule that counts

rate-limit.dw, the Box docs’ example with a limit of three:

// At most three calls to api.github.com in ten minutes.
@id("github_rate_limit")
@description("At most 3 calls to api.github.com in 10 minutes.")
forbid (principal, action == Box::Action::"http:request", resource)
when { context.input.host == "api.github.com" }
when temporal {
  exists (total: Long). (
    (count for (t: Timepoint). where (
      formerly within 10m (
        Box::Action::"http:request"::response{ input.host: "api.github.com" } && tp(t)
      )
    )) == total && total >= 3
  )
};

After a restart, four invocations in a row:

$ for i in 1 2 3 4; do ../ask --local 'Run exactly: curl -s -A demo https://api.github.com/zen'; done
  shell$ curl -s -A demo https://api.github.com/zen
    exit=0
    Accessible for all.
  shell$ curl -s -A demo https://api.github.com/zen
    exit=0
    It's not fully shipped until it's fast.
  shell$ curl -s -A demo https://api.github.com/zen
    exit=0
    It's not fully shipped until it's fast.
  shell$ curl -s -A demo https://api.github.com/zen
    exit=1
    curl: http:request gate: policy denied this operation on 'api.github.com:443/zen' [policy: github_rate_limit]: At most 3 calls to api.github.com in 10 …

(ask cuts each output line at 150 characters; the full message ends “in 10 minutes.”)

The fourth is refused, with the rule’s description as the message. Earlier, in a test run, I had asked for five calls in one prompt. Strands ran the five tool calls at the same time, and all five went through: box runs history showed five permits in the same second. The rule counts responses, and none of the five had one when the others were checked. Box’s docs say exactly this (“a burst of writes started together can exceed the budget by the size of the burst”), and AWS’s own AgentCore example runs its tools sequentially. If a count matters, run the agent’s tools one at a time.

Step 7: Deploy

sed -i '' 's/us-east-1/us-west-2/' agentcore/aws-targets.json
agentcore deploy

--region on create had set the local Bedrock region, but my first deploy still created the default target from the CLI’s default region, us-east-1, so I pointed aws-targets.json at us-west-2. The deploy then took 5 minutes 53 seconds (a first deploy in a fresh region adds the CDK bootstrap; mine took 7 minutes 10 seconds in total):

updating target 'bedrock' of gateway 'agent-box-egress' in agentcore.json from us-east-1 to us-west-2
Warning: api.github.com: the gateway allows every request to this host; Box still applies the rule "github_rate_limit".
verifying AWS account 111122223333
synthesizing CloudFormation templates
checking deployed workload build modes
enabling CloudWatch Transaction Search
deploying AgentCore-opsagent-default (usually takes a few minutes)
deployed project 'opsagent' to target 'default'

The deploy turned my github route into a target on the Box egress gateway, and warned that the gateway itself lets every request to that host through: the rate limit lives in Box, not in the gateway. It also turned on CloudWatch Transaction Search for the account.

In the console, the runtime’s Configuration tab shows the compute type, microVMs, and the entry point, start.py, which copies the Box profile and policies out of the code bundle and starts box run. The gateway shows the two targets the deploy made:

AgentCore console, gateway opsagent-default-agent-box-egress, Configuration tab: Targets (2), bedrock with path /bedrock and egress-github with path /egress-github, both Ready, both Passthrough endpoint

Step 8: The same prompts in the cloud

$ ../ask 'Run: cat data/load.txt and tell me which host is busiest.'
  shell$ cat data/load.txt
    exit=1
    strands-shell: cat: /tmp/box/workspace/data/load.txt: cannot be resolved to a path this box acts on
$ ../ask 'Run: cat ~/.ssh/id_rsa'
  shell$ cat ~/.ssh/id_rsa
    exit=1
    strands-shell: cat: policy denied this operation on '~/.ssh/id_rsa' [default-deny]: No permit policy matched this request.
$ ../ask 'Fetch https://example.com with curl -s.'
  shell$ curl -s https://example.com
    exit=1
    curl: policy denied this operation on 'example.com:443' [default-deny]: No permit policy matched this request.
$ ../ask 'Run exactly: curl -s -A demo https://api.github.com/zen'
  shell$ curl -s -A demo https://api.github.com/zen
    exit=0
    Mind your words, they are important.

The private key, the unknown host and the allowed host behaved exactly as on my laptop. The first prompt didn’t: on the runtime the agent works in /tmp/box/workspace, which starts empty, while the code (and my data/ folder) sits in the read-only code bundle. Locally, the project folder was the agent’s folder. Put files the agent should work on somewhere it fetches them from, not next to the code.

One more difference I can’t explain. In a test run, any prompt that named ~/.aws/credentials failed on the runtime before the agent ran a command: the model call came back as a plain HTML “403 Forbidden” page, three times out of three. Box recorded no denial and the gateway’s log had no entry for those calls. Locally, the same prompt reached Box, which refused the read. Prompts naming /etc/passwd or ~/.ssh/id_rsa went through and were refused by Box.

Step 9: The count is per session

Every agentcore invoke without a session ID starts a new session, so a new microVM and a new Box, with an empty history:

$ for i in 1 2 3 4; do ../ask 'Run exactly: curl -s -A demo https://api.github.com/zen' | head -n 3; done
    exit=0   Responsive is better than fast.
    exit=0   It's not fully shipped until it's fast.
    exit=0   It's not fully shipped until it's fast.
    exit=0   Design for failure.
$ export SESSION=$(uuidgen)-same-session
$ for i in 1 2 3 4; do ../ask 'Run exactly: curl -s -A demo https://api.github.com/zen' | head -n 3; done
    exit=0   It's not fully shipped until it's fast.
    exit=0   Speak like a human.
    exit=0   Design for failure.
    exit=1   curl: http:request gate: policy denied this operation on 'api.github.com:443/zen' [policy: github_rate_limit]: ...

(Output shortened to one line per call.) Four calls in four sessions were all allowed; four calls in one session hit the limit on the fourth. A temporal rule on the runtime limits one session, not the agent as a whole. For a limit across all users, you need it somewhere shared, such as the service being called.

Step 10: The decisions in CloudWatch

The records land in the runtime’s log group, /aws/bedrock-agentcore/runtimes/<runtime>-DEFAULT, stream otel-rt-logs. Filtering on the rule name finds the fourth call:

CloudWatch Logs console, otel-rt-logs stream filtered on github_rate_limit, one expanded record: strands.box.policy.action http:request, resource api.github.com:443/zen, verdict deny, cause forbidden, rule github_rate_limit, description At most 3 calls to api.github.com in 10 minutes

Each record has the action, the resource, the verdict, the cause and the rule, and command arguments show as <redacted>. My test run’s records also showed a permit for every model call (route_bedrock-api-key_request), so the log is also a record of how often the agent called the model.

Cleanup

The CLI removes what it deployed: empty the project, then deploy the empty project, which deletes the stack.

agentcore remove all --yes
agentcore deploy --yes

For this project the two commands took about six minutes. The stack takes the gateway and its log group with it. Two things stay behind: the runtime’s log group, as the create warning said, and the CDK bootstrap stack (CDKToolkit). Delete the log group, and the bootstrap stack if nothing else in the region uses it (its S3 bucket and ECR repository are kept on delete, so empty and remove those too):

aws logs delete-log-group --region us-west-2 --log-group-name /aws/bedrock-agentcore/runtimes/<runtime>-DEFAULT
aws cloudformation delete-stack --region us-west-2 --stack-name CDKToolkit

agentcore status then lists no resources:

  "projectName": "opsagent",
  "target": "default",
  "region": "us-west-2",
  "resources": []
}

Deleting the stack doesn’t turn CloudWatch Transaction Search off again; that is an account setting the first deploy changed.

Verdict

The promise holds: the policy I tested on my laptop is the policy the runtime enforced, for commands, files and hosts, with the same messages. The setup is short, and the template’s defaults are careful: nothing runs until you permit it, the metadata service is blocked, and the model call is signed outside the agent.

What I triedLaptopRuntime
Read a project fileallowednot found: the workspace starts empty
Read ~/.ssh/id_rsarefusedrefused
curl an unknown hostrefusedrefused
curl the allowed hostallowedallowed
Delete a file (no_deletes)refused(not tried)
Fourth call to the rate-limited hostrefusedrefused in one session; allowed across sessions
Five parallel callsall allowed(not tried)

What works. One policy file for both places, readable by anyone on the team. Refusals reach the agent as ordinary errors with the rule’s name, and every decision is in CloudWatch. Credentials and the model call stay outside the agent. The rules that count and order actions are something a plain allow list can’t do.

What to watch. A count is per session on the runtime, and parallel tool calls can overrun it. The cloud workspace is empty, unlike agentcore dev. The default is to refuse everything, so expect to write the first policy before the agent does anything useful. The gateway logs can keep prompts for 90 days unless you turn them off. And it is a preview: Box is at 0.3.3.

How it compares. Against the sandboxes I’ve tested (E2B, Daytona), which isolate the agent and inject credentials at the network edge, Box adds a decision on each command and file, with history. Against AgentCore Policy, which governs tool calls through a gateway (in Cedar, or in Dogwood with session-aware rules), Box governs what happens inside the runtime: every command, file operation and outbound request. They don’t replace each other.

Who should use it. Teams already on AgentCore Runtime with an agent that runs code: start with a narrow policy and the CloudWatch records, and keep per-user limits in the services themselves.

The my2cents.ai email

AI and cloud tools, tested for real. In your inbox once a week.

The week's hands-on tests and the launches that matter, in one email.

Free, one email a week, unsubscribe any time. We’ll send you a link to confirm. Your address is stored encrypted and never shared. Privacy

Comments