OpenClaw Agents 管理指南:快速建立、設定與自訂身分
在開發 AI 應用的過程中,管理多個不同的 Agent 往往會變得非常混亂。你可能需要為不同的專案隔離 Workspace,或者為特定的通訊頻道設定專屬的路由與身分,但又不希望這些設定全部擠在一起。
openclaw agents 指令就是為了簡化這些工作而設計的,讓你能夠輕鬆管理隔離的 Agent 環境,包含它們的 Workspace、驗證資訊以及路由規則。
openclaw agents
Section titled “openclaw agents”管理隔離的 Agent(包含 Workspace、驗證與路由設定)。
相關連結:
- 多 Agent 路由:Multi-Agent Routing
- Agent workspace:Agent workspace
- Skill 可見性配置:Skills config
openclaw agents listopenclaw agents list --bindingsopenclaw agents add work --workspace ~/.openclaw/workspace-workopenclaw agents add ops --workspace ~/.openclaw/workspace-ops --bind telegram:ops --non-interactiveopenclaw agents bindingsopenclaw agents bind --agent work --bind telegram:opsopenclaw agents unbind --agent work --bind telegram:opsopenclaw agents set-identity --workspace ~/.openclaw/workspace --from-identityopenclaw agents set-identity --agent main --avatar avatars/openclaw.pngopenclaw agents delete work使用路由綁定(Routing bindings)將特定頻道的流量固定到某個 Agent。
如果你希望每個 Agent 擁有不同的可見 Skill,請在 openclaw.json 中配置 agents.defaults.skills 和 agents.list[].skills。參考 Skills config 與 Configuration Reference。
列出綁定:
openclaw agents bindingsopenclaw agents bindings --agent workopenclaw agents bindings --json新增綁定:
openclaw agents bind --agent work --bind telegram:ops --bind discord:guild-a如果你省略了 accountId(例如 --bind <channel>),OpenClaw 會從頻道預設值和插件設定 Hook 中解析它(如果可用)。
如果在執行 bind 或 unbind 時省略了 --agent,OpenClaw 會以目前的預設 Agent 為目標。
綁定範圍行為
Section titled “綁定範圍行為”- 沒有
accountId的綁定僅會匹配頻道的預設帳號。 accountId: "*"是頻道範圍的備選方案(所有帳號),其優先級低於明確的帳號綁定。- 如果同一個 Agent 已經有一個不帶
accountId的匹配頻道綁定,而你稍後使用明確或解析出的accountId進行綁定,OpenClaw 會直接更新該現有綁定,而不是新增一個重複項。
範例:
# initial channel-only bindingopenclaw agents bind --agent work --bind telegram
# later upgrade to account-scoped bindingopenclaw agents bind --agent work --bind telegram:ops升級後,該綁定的路由將被限定在 telegram:ops。如果你也需要預設帳號的路由,請明確地新增它(例如 --bind telegram:default)。
移除綁定:
openclaw agents unbind --agent work --bind telegram:opsopenclaw agents unbind --agent work --allunbind 僅接受 --all 或一個以上的 --bind 值,不能同時使用兩者。
agents
Section titled “agents”執行 openclaw agents 而不帶任何子指令,等同於執行 openclaw agents list。
agents list
Section titled “agents list”選項:
--json--bindings:包含完整的路由規則,而不僅是每個 Agent 的計數或摘要。
agents add [name]
Section titled “agents add [name]”選項:
--workspace <dir>--model <id>--agent-dir <dir>--bind <channel[:accountId]>(可重複使用)--non-interactive--json
備註:
- 傳入任何明確的新增旗標(flags)都會將指令切換到非互動模式。
- 非互動模式需要同時提供 Agent 名稱與
--workspace。 main是保留字,不能用作新的 Agent ID。
agents bindings
Section titled “agents bindings”選項:
--agent <id>--json
agents bind
Section titled “agents bind”選項:
--agent <id>(預設為目前的預設 Agent)--bind <channel[:accountId]>(可重複使用)--json
agents unbind
Section titled “agents unbind”選項:
--agent <id>(預設為目前的預設 Agent)--bind <channel[:accountId]>(可重複使用)--all--json
agents delete <id>
Section titled “agents delete <id>”選項:
--force--json
備註:
main無法被刪除。- 若未使用
--force,則需要進行互動式確認。 - Workspace、Agent 狀態和 Session 紀錄目錄會被移至垃圾桶,而非直接刪除。
每個 Agent Workspace 的根目錄都可以包含一個 IDENTITY.md 檔案:
- 範例路徑:
~/.openclaw/workspace/IDENTITY.md set-identity --from-identity會從 Workspace 根目錄(或明確指定的--identity-file)讀取內容。
Avatar(頭像)路徑會相對於 Workspace 根目錄進行解析。
set-identity 會將欄位寫入 agents.list[].identity:
namethemeemojiavatar(Workspace 相對路徑、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 共用該 Workspace,指令會失敗並要求你傳入--agent。 - 當沒有提供明確的身分欄位時,指令會從
IDENTITY.md讀取身分資料。
從 IDENTITY.md 載入:
openclaw agents set-identity --workspace ~/.openclaw/workspace --from-identity明確覆蓋欄位:
openclaw agents set-identity --agent main --name "OpenClaw" --emoji "🦞" --avatar avatars/openclaw.png配置範例:
{ agents: { list: [ { id: "main", identity: { name: "OpenClaw", theme: "space lobster", emoji: "🦞", avatar: "avatars/openclaw.png", }, }, ], },}OpenClaw Expert
還是卡住了?
如果這篇文件沒有解決你的情境,直接問 OpenClaw Expert,拿到可執行步驟。