Files
myWiki/concepts/agent-sandbox.md
2026-06-01 10:46:01 +08:00

51 lines
1.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
title: "Agent SandboxAgent 沙箱)"
created: 2026-05-30
updated: 2026-05-30
type: concept
tags: [agent, sandbox, security, execution-environment]
sources: [[agent-harness-engineering-survey]]
confidence: high
---
# Agent Sandbox
> Agent 代码执行的安全隔离环境,是 [[execution-environment|Execution Environment]] (E 层) 的核心组件。
## 沙箱分类
### 1. 进程级沙箱
- Docker 容器、gVisor、Firecracker microVM
- 优点:成熟、广泛支持
- 缺点:启动延迟、资源开销
### 2. 语言级沙箱
- Python `exec()` / `eval()` 限制、RestrictedPython
- 优点:零启动延迟、轻量
- 缺点:逃逸风险高
### 3. WebAssembly (Wasm) 沙箱
- WasmEdge、wasmtime 运行时
- 优点:接近原生性能、强隔离、跨平台
- 新兴方向,尚未成为主流
### 4. 浏览器沙箱
- Playwright、Puppeteer 驱动
- 用于 Web Agent如 WebArena 评测)
## 沙箱逃逸与威胁模型
- Agent 的代码执行能力使其具有潜在的安全威胁
- 关键挑战Agent 可能通过生成代码绕过沙箱限制
- 防御:多层隔离 + 网络限制 + 文件系统只读挂载
## 部署模式
- **本地沙箱**:延迟最低,风险最高
- **远程沙箱**eg. Modal、Replit 等云平台
- **混合模式**:敏感操作远程,常规操作本地
## 相关概念
- [[execution-environment]] — E 层总体
- [[agent-governance]] — G 层的安全约束
- [[etclovg-taxonomy]] — 七层分类体系