openclaw

关注公众号 jb51net

关闭
AI > openclaw >

OpenClaw Tools 配置详解:全局设置与单Agent配置

SP八岐大兔

一、核心配置思路

二、完整可直接使用的配置

{
  "gateway": {
    "port": 18789,
    "enabled": true
  },
  // 全局默认:最小权限(仅聊天)
  "tools": {
    "profile": "messaging",
    "allow": [],
    "deny": ["*"]
  },
  "agents": {
    "list": [
      // Agent1:本地文件读写专用(id: file-agent)
      {
        "id": "file-agent",
        "name": "本地文件助手",
        "default": true,
        "workspace": "~/.openclaw/workspace-file",
        "tools": {
          "profile": "coding",
          "allow": ["group:fs"],
          "deny": ["group:web", "browser", "web_search", "web_fetch", "exec"]
        },
        "sandbox": {
          "mode": "restricted",
          "filesystem": {
            "read": ["~/Documents", "~/Projects"],	// 只能读这里,为空则禁止
            "write": ["~/Documents/OpenClaw"]		// 只能写这里,为空则禁止
          }
        }
      },
      // Agent2:GitHub/网络访问专用(id: github-agent)
      {
        "id": "github-agent",
        "name": "GitHub 助手",
        "workspace": "~/.openclaw/workspace-github",
        "tools": {
          "profile": "full",
          "allow": ["group:web", "browser", "web_search", "web_fetch"],
          "deny": ["group:fs", "exec", "process"]
        },
        "sandbox": {
          "mode": "strict",
          "filesystem": {
            "read": [],		// 禁止读任何文件
            "write": []		// 禁止写任何文件
          }
        }
      }
    ]
  }
}

三、关键配置说明

1. Agent 定义(agents.list)

2.profile 是做什么的?(超级重要)

profile = 工具预设套餐
OpenClaw 提前给你打包好的工具组合,不用你一个个手动加工具。
4 种官方 profilejson

"profile": "full"       // 全部工具(文件+命令+网络+浏览器)
"profile": "coding"     // 开发工具(文件+编辑+git)
"profile": "messaging"  // 仅聊天(无任何工具权限)
"profile": "minimal"    // 最小工具(仅基础功能)

你写 profile: coding,就等于自动启用一组文件 / 代码工具。不用你在 allow 里手写 read、write、edit…
如果需要自定,则手动根据自定义权限要求配置allow和deny。

3.为什么要加 sandbox?(安全核心)

sandbox = 沙箱 / 权限牢笼
**不加 sandbox 会怎样?**
Agent 能读你整个电脑的文件
能删系统文件、读密码、读桌面所有内容
非常危险 ❌
**加了 sandbox 会怎样?**
只能访问你指定的文件夹
不能越界
不能读系统盘、不能乱删文件
100% 安全 ✅
sandbox 真正作用总结
sandbox 不是可选的,是必须的!
它用来:
限制文件访问范围
限制命令执行权限
限制网络访问范围
防止 Agent 破坏你的电脑

4. Agent1(文件助手)权限

5. Agent2(GitHub 助手)权限

四、生效与使用步骤

五、安全与扩展建议

需要我帮你把这个配置适配到你的本地路径(比如指定可读写的文件夹),并生成对应的Web-UI 快速切换链接吗?

到此这篇关于OpenClaw Tools 配置详解:全局设置与单Agent配置的文章就介绍到这了,更多相关OpenClaw tools配置内容请搜索脚本之家以前的文章或继续浏览下面的相关文章,希望大家以后多多支持脚本之家!