跳到正文
视频中级

在 Cloudflare Sandbox 中安全运行 LLM 生成的代码

如何防止 LLM 生成的代码窃取凭证:一个支持 MCP 的 Worker,为每个工作区分配沙箱,配置出站策略,并在容器外注入凭证。

发布时间
2026年11月4日
在 YouTube 观看

该介绍目前仅提供英文版本。

A walkthrough of an MCP-enabled Cloudflare Worker with three tools — open workspace, run code and close workspace. Each workspace gets its own Durable Object and sandbox container, so an agent can clone a repo, run npm install and retry its scripts in the same isolated environment.

What you’ll learn

  • Give each workspace its own Durable Object and sandbox container
  • Expose open/run/close tools over MCP
  • Lock down outbound traffic with an egress policy
  • Attach GitHub credentials from the Worker, outside the container

Cloudflare products used

Sandbox SDK, Durable Objects, Workers.

Watch the full video on the Cloudflare Developers YouTube channel.

继续学习