Documentation Index
Fetch the complete documentation index at: https://openclaw.zhcndoc.com/llms.txt
Use this file to discover all available pages before exploring further.
openclaw agents
管理隔离的 agent(工作区 + 认证 + 路由)。
相关:
- 多 agent 路由
- Agent 工作区
- Skills 配置:技能可见性配置。
示例
路由绑定
使用路由绑定将入站频道流量固定到特定的 agent。 如果你还想为每个 agent 配置不同的可见技能,请在openclaw.json 中配置 agents.defaults.skills 和 agents.list[].skills。参见 Skills 配置 和 配置参考。
列出绑定:
accountId(--bind <channel>),OpenClaw 会在可用时从频道默认值和插件设置钩子中解析它。
如果你在 bind 或 unbind 中省略 --agent,OpenClaw 会将目标设为当前默认 agent。
绑定范围行为
- 不带
accountId的绑定只匹配频道默认账号。 accountId: "*"是频道级兜底(所有账号),其优先级低于显式账号绑定。- 如果同一个 agent 已经有一个不带
accountId的匹配频道绑定,而你之后又用显式或已解析的accountId进行绑定,OpenClaw 会直接升级现有绑定,而不是新增重复项。
telegram:ops。如果你也希望使用默认账号路由,请显式添加它(例如 --bind telegram:default)。
移除绑定:
unbind 接受 --all 或一个或多个 --bind 值,但不能同时使用两者。
命令表面
agents
不带子命令直接运行 openclaw agents 等同于 openclaw agents list。
agents list
选项:
--json--bindings:包含完整路由规则,而不只是每个 agent 的计数/摘要
agents add [name]
选项:
--workspace <dir>--model <id>--agent-dir <dir>--bind <channel[:accountId]>(可重复)--non-interactive--json
- 传入任何显式的 add 参数都会使命令切换到非交互路径。
- 非交互模式要求同时提供 agent 名称和
--workspace。 main是保留值,不能作为新的 agent id 使用。- 在交互模式下,认证种子只会复制可移植的静态配置文件
(默认情况下包括
api_key和静态token)。OAuth 刷新令牌配置仍然 只能通过对真实mainagent 存储的读取继承来获得。 如果配置的默认 agent 不是main,请在新 agent 上单独登录 OAuth 配置。
agents bindings
选项:
--agent <id>--json
agents bind
选项:
--agent <id>(默认当前默认 agent)--bind <channel[:accountId]>(可重复)--json
agents unbind
选项:
--agent <id>(默认当前默认 agent)--bind <channel[:accountId]>(可重复)--all--json
agents delete <id>
选项:
--force--json
main不能被删除。- 未使用
--force时,需要交互式确认。 - 工作区、agent 状态以及会话转录目录会移动到废纸篓,而不是直接硬删除。
- 当 Gateway 可达时,删除会通过 Gateway 发送,因此配置和会话存储清理会与运行时流量共享同一个写入方。如果 Gateway 不可达,CLI 会回退到离线本地路径。
- 如果另一个 agent 的工作区与此工作区是同一路径、位于此工作区内部,或包含此工作区,
则会保留该工作区,并且
--json会报告workspaceRetained、workspaceRetainedReason和workspaceSharedWith。
身份文件
每个 agent 工作区都可以在工作区根目录包含一个IDENTITY.md:
- 示例路径:
~/.openclaw/workspace/IDENTITY.md set-identity --from-identity会从工作区根目录(或显式指定的--identity-file)读取
设置身份
set-identity 会将字段写入 agents.list[].identity:
namethemeemojiavatar(工作区相对路径、http(s) URL 或 data URI)
--agent <id>--workspace <dir>--identity-file <path>--from-identity--name <name>--theme <theme>--emoji <emoji>--avatar <value>--json
- 可使用
--agent或--workspace来选择目标 agent。 - 如果你依赖
--workspace,而多个 agent 共享该工作区,命令会失败并要求你传入--agent。 - 当未提供显式身份字段时,命令会从
IDENTITY.md读取身份数据。
IDENTITY.md 加载: