box README

项目的 README,来自 github.com/strands-agents/box。合并为一个 markdown 文件:README.md。

Strands

Strands Box

Run coding agents like Claude Code in a sandbox, under a policy you control.

Commit Activity Open Issues Open PRs Discord

Overview

With box, you run a coding agent such as Claude Code, Codex, Kiro CLI, or pi in a box on your own machine. The agent can work in your project and reach whatever you allow. Your other files, your keys, and services that listen only on localhost stay out of its reach. You use the agent the way you always do, with its permission prompts off if you like.

Underneath box is Box Core, an engine you can also use on its own. box itself is in preview, and it works on Apple silicon Macs with macOS 15 or later and on Linux ARM64 and x86-64.

Install

brew install --cask strands-agents/tap/box

Or with the installer:

curl -fsSL https://raw.githubusercontent.com/strands-agents/box/main/install.sh | sh

Then open a new terminal and run box --version to check that it worked. For the Linux requirements, upgrading, and uninstalling, see Install Box.

Run your first agent

You set up each agent once, in a profile, and then start it from any of your projects. For Claude Code on Amazon Bedrock, install Claude Code with its native installer, then create the profile:

box profile create claude --with bedrock

Press Enter to take each default, then choose Save profile and Exit. You'll need to connect to Bedrock, and choose a model if Claude Code doesn't already name one, before the first run. Then start Claude Code from the folder you want it to work in:

cd ~/src/my-app
box run claude

For the full walkthrough, see Get started.

How Box works

The agent runs in an OS sandbox inside the box. Its requests go to Box, which checks each one against your policy before it reaches files, commands, the network, or MCP tools. Denied requests stop there.

The agent runs in an operating system sandbox, so its own reads and writes stay within the files you grant it. Box checks each shell command, network request, and MCP tool call against your policy before it happens, and it does that outside the model, where nothing the agent reads can change the answer.

You write policies in Dogwood, or start from one that comes with box. A rule can even depend on what the agent already did, such as a limit of 60 calls to a server in an hour.

Your keys stay outside the box, too. When the agent calls its model or another service you've set up, it only sees a placeholder, and Box puts in the real key as the request leaves.

To see how it all fits together, read How Box works.

Learn more

Box Core

Box Core is the engine under box. You can run it yourself, on your own machine or a cloud host, or embed it in a Rust application. Instead of a profile, you describe each box in box.toml and its policy in policy.dw. To download Box Core into ./box-core:

curl -fsSL https://raw.githubusercontent.com/strands-agents/box/main/download.sh | sh
./box-core/box --version

Start with Run an agent with box.toml. After that, you'll find the box.toml reference, the policy guides, and cloud deployments in the Box Core guide, and finished setups you can run in the examples. To embed Box Core in your own application, see Use Box as a Rust library.

Build from source

To build box yourself, you need rustup and just:

git clone https://github.com/strands-agents/box.git
cd box
just build-cli

You'll find box and the Box Core programs it runs in target/debug. For the tests and the other builds, see CONTRIBUTING.md.

Reporting a problem

If something goes wrong, open an issue with the command you ran, what you expected, what happened instead, and the output of box --version. If you think you've found a security problem, read SECURITY.md first.

License

Apache License 2.0.

box (strands-agents/box)

正在搜索数据库…

557 ·GitHub
这是什么?Box 是一个用于运行 AI 智能体的开源沙箱,限制它们能执行、读取、写入以及在网络上访问的内容,将操作系统级隔离与策略引擎(Dogwood)和凭据注入相结合,确保密钥永远不会到达智能体。
这是我导入的库,还是让我的智能体在里面运行的沙箱运行时?Box 是一个独立的沙箱引擎,不是库:你在 box.toml 中配置操作系统级访问授权,在 policy.dw 中配置语义规则,然后通过 Box 自己的解释器(Strands Shell 和用于 Python 的 Monty)和网关运行你选择的智能体程序。
怎么让 Box 跑起来?按照入门指南操作:运行下载脚本,它会检查发行版校验和并把二进制解包到 ./box-core(或用 Cargo 从源码构建),然后编写 box.toml 和 policy.dw,并运行 box 二进制。
尝试入门指南之前需要准备什么?你需要一台搭载 Apple 芯片、运行 macOS 15 或更高版本的 Mac,通过 Homebrew 安装的 Node.js 22.21+,以及 us-west-2 区域 Amazon Bedrock 上 Claude Opus 5 的访问权限。
Box 已经可以在任何机器上投入生产使用了吗?没有——这是一个预览版本,目前仅支持在搭载 Apple 芯片的 macOS 上本地运行;Linux 支持已在计划中,但尚未发布。
智能体会看到它使用的 API 密钥吗?不会——出口网关会使用配置好的 API 凭据或 AWS SigV4 签名自行认证获准的出站请求,智能体进程永远不会拿到底层密钥。
Dogwood 是什么?Dogwood 是 Box 使用的策略语言,基于 permit 和 forbid 规则构建;每个受检查的操作默认被拒绝,除非有 permit 规则允许它,而匹配的 forbid 规则始终会覆盖该许可。
Strands Shell 和 Monty 是什么?它们是 Box 内置的解释器,分别用于 shell 命令和 Python 代码;两者执行的每个操作都会先经过 Dogwood 策略引擎,然后才执行。
策略能根据已经发生的事情阻止后续操作吗?可以——Box 的解释器和网关共享一份事件历史,因此规则可以因为较早的一次文件读取而拒绝稍后的出站 HTTP 请求。
MCP broker 是做什么的?它在工具调用到达 MCP 服务器之前,依据 Dogwood 策略检查配置好的 MCP 工具调用及其参数,方式与出口网关检查网络请求相同。
大小
15.5 MB
星标
557
时长
2个月
提交 · 90 天