Strands Box for Beginners: How to Put an AI Agent Behind a Policy Guard

Put an AI coding agent inside AWS's open-source Strands Box, watch it refuse a file write, read the decision log, then allow the write with one policy rule. Includes a starter repo and a clean-up step.

AWS Community Builder - AI Engineering | Junior Engineer @ MulticoreWare
AI coding agents now run commands and edit files with no human approval ("YOLO mode"). Strands Box, an open-source AWS tool in developer preview, puts an agent in a sandbox and checks every action against rules you write. You will put the Strands CLI in a box, watch it refuse a file write, read the decision log, allow the write with one rule, then clean up. It takes 30 to 45 minutes.
The files come from the official getting-started guide and are in a ready-to-clone repo:  https://github.com/keshsrini/CB-Speed-Race-to-100 

How it works

Think of a sandbox as a room and  policy.dw  as a guard at every door. Each command, file operation, tool call and network request is checked, and anything no rule permits is refused. A  forbid  beats a  permit .  box.toml  says what runs and what it can reach, and  policy.dw  decides each request.

You need

An Apple silicon Mac (macOS 15+), Node 22.21+, jq, and Bedrock access to Claude Opus 5 in us-west-2.

Steps

git clone https://github.com/keshsrini/CB-Speed-Race-to-100 ~/box-tutorial
cd ~/box-tutorial
curl -fsSL https://raw.githubusercontent.com/strands-agents/box/refs/heads/main/download.sh | sh
/opt/homebrew/bin/npm install -g @strands-agents/cli
sh bootstrap.sh
export AWS_BEARER_TOKEN_BEDROCK="your-short-term-key"
./box-core/box run --config my-box/box.toml
Make the key in the Bedrock console (us-west-2, API keys, short-term). Box adds it at the gateway, so the agent only sees a stand-in. The starting policy allows reads in the project but no writes. Ask: "Read README.md, then add a line that says hello." The write is refused. Type  /exit .

Verify

sh scripts/decision-log.sh
You see  permit fs:read  for the README and  deny fs:write . The log also shows things the agent did on its own, like a startup command Box refused.

Allow the write

Add this to the end of  my-box/policy.dw , run again and ask the same thing:
@id("project_write")
permit (principal, action == Box::Action::"fs:write", resource)
when { context.input.path like "~/box-tutorial/my-project/*" };
The log now shows  permit fs:write . That is the loop: run, read what was refused, allow only what is needed.

Clean up

unset AWS_BEARER_TOKEN_BEDROCK
/opt/homebrew/bin/npm uninstall -g @strands-agents/cli
rm -rf ~/box-tutorial

Watch out

  • Box is in preview, so pin your version with  ./box-core/box --version .
  • Paths granted in  box.toml  bypass the policy and the log.
  • Short-term keys expire within 12 hours.
Source: github.com/strands-agents/box
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article