在沙箱后端内运行工具,减少爆炸半径。可选,默认关闭。

沙箱范围

沙箱内:工具执行(exec/read/write/edit/apply_patch/process 等)、可选沙箱浏览器

不沙箱:Gateway 进程本身、Elevated 工具(显式允许在沙箱外运行)

配置

{
  agents: {
    defaults: {
      sandbox: {
        mode: "off",       // off | non-main | all
        scope: "session",  // session | agent | global
        backend: "docker", // docker | ssh | openshell
      },
    },
  },
}

模式

  • off:不沙箱
  • non-main:仅沙箱非主会话(群组/频道会话)
  • all:所有会话都在沙箱中运行

后端

  • docker:Docker 容器(默认,需要 Docker)
  • ssh:SSH 远程执行
  • openshell:OpenShell 后端

沙箱浏览器

{
  agents: {
    defaults: {
      sandbox: {
        browser: {
          autoStart: true,
          network: "openclaw-sandbox-browser",
          allowHostControl: false,
        },
      },
    },
  },
}

工具策略

{
  tools: {
    profile: "coding",  // coding | full | minimal
    exec: {
      security: "allowlist",  // allowlist | ask | full
    },
  },
}

相关

  • concepts/tool-exec — exec 工具
  • concepts/tool-exec-approvals — exec 审批策略
  • concepts/tool-elevated — Elevated 模式
  • concepts/gateway-runbook — Gateway 运维