ACP agents
Agent Client Protocol (ACP) sessions let OpenClaw run external coding harnesses (for example Pi, Claude Code, Codex, OpenCode, and Gemini CLI) through an ACP backend plugin. If you ask OpenClaw in plain language to โrun this in Codexโ or โstart Claude Code in a threadโ, OpenClaw should route that request to the ACP runtime (not the native sub-agent runtime).Fast operator flow
Use this when you want a practical/acp runbook:
- Spawn a session:
/acp spawn codex --mode persistent --thread auto
- Work in the bound thread (or target that session key explicitly).
- Check runtime state:
/acp status
- Tune runtime options as needed:
/acp model <provider/model>/acp permissions <profile>/acp timeout <seconds>
- Nudge an active session without replacing context:
/acp steer tighten logging and continue
- Stop work:
/acp cancel(stop current turn), or/acp close(close session + remove bindings)
Quick start for humans
Examples of natural requests:- โStart a persistent Codex session in a thread here and keep it focused.โ
- โRun this as a one-shot Claude Code ACP session and summarize the result.โ
- โUse Gemini CLI for this task in a thread, then keep follow-ups in that same thread.โ
- Pick
runtime: "acp". - Resolve the requested harness target (
agentId, for examplecodex). - If thread binding is requested and the current channel supports it, bind the ACP session to the thread.
- Route follow-up thread messages to that same ACP session until unfocused/closed/expired.
ACP versus sub-agents
Use ACP when you want an external harness runtime. Use sub-agents when you want OpenClaw-native delegated runs.| Area | ACP session | Sub-agent run |
|---|---|---|
| Runtime | ACP backend plugin (for example acpx) | OpenClaw native sub-agent runtime |
| Session key | agent:<agentId>:acp:<uuid> | agent:<agentId>:subagent:<uuid> |
| Main commands | /acp ... | /subagents ... |
| Spawn tool | sessions_spawn with runtime:"acp" | sessions_spawn (default runtime) |
Thread-bound sessions (channel-agnostic)
When thread bindings are enabled for a channel adapter, ACP sessions can be bound to threads:- OpenClaw binds a thread to a target ACP session.
- Follow-up messages in that thread route to the bound ACP session.
- ACP output is delivered back to the same thread.
- Unfocus/close/archive/idle-timeout or max-age expiry removes the binding.
acp.enabled=trueacp.dispatch.enabled=true- Channel-adapter ACP thread-spawn flag enabled (adapter-specific)
- Discord:
channels.discord.threadBindings.spawnAcpSessions=true
- Discord:
Thread supporting channels
- Any channel adapter that exposes session/thread binding capability.
- Current built-in support: Discord.
- Plugin channels can add support through the same binding interface.
Start ACP sessions (interfaces)
From sessions_spawn
Use runtime: "acp" to start an ACP session from an agent turn or tool call.
runtimedefaults tosubagent, so setruntime: "acp"explicitly for ACP sessions.- If
agentIdis omitted, OpenClaw usesacp.defaultAgentwhen configured. mode: "session"requiresthread: trueto keep a persistent bound conversation.
task(required): initial prompt sent to the ACP session.runtime(required for ACP): must be"acp".agentId(optional): ACP target harness id. Falls back toacp.defaultAgentif set.thread(optional, defaultfalse): request thread binding flow where supported.mode(optional):run(one-shot) orsession(persistent).- default is
run - if
thread: trueand mode omitted, OpenClaw may default to persistent behavior per runtime path mode: "session"requiresthread: true
- default is
cwd(optional): requested runtime working directory (validated by backend/runtime policy).label(optional): operator-facing label used in session/banner text.
From /acp command
Use /acp spawn for explicit operator control from chat when needed.
--mode persistent|oneshot--thread auto|here|off--cwd <absolute-path>--label <name>
Session target resolution
Most/acp actions accept an optional session target (session-key, session-id, or session-label).
Resolution order:
- Explicit target argument (or
--sessionfor/acp steer)- tries key
- then UUID-shaped session id
- then label
- Current thread binding (if this conversation/thread is bound to an ACP session)
- Current requester session fallback
Unable to resolve session target: ...).
Spawn thread modes
/acp spawn supports --thread auto|here|off.
| Mode | Behavior |
|---|---|
auto | In an active thread: bind that thread. Outside a thread: create/bind a child thread when supported. |
here | Require current active thread; fail if not in one. |
off | No binding. Session starts unbound. |
- On non-thread binding surfaces, default behavior is effectively
off. - Thread-bound spawn requires channel policy support (for Discord:
channels.discord.threadBindings.spawnAcpSessions=true).
ACP controls
Available command family:/acp spawn/acp cancel/acp steer/acp close/acp status/acp set-mode/acp set/acp cwd/acp permissions/acp timeout/acp model/acp reset-options/acp sessions/acp doctor/acp install
/acp status shows the effective runtime options and, when available, both runtime-level and backend-level session identifiers.
Some controls depend on backend capabilities. If a backend does not support a control, OpenClaw returns a clear unsupported-control error.
ACP command cookbook
| Command | What it does | Example |
|---|---|---|
/acp spawn | Create ACP session; optional thread bind. | /acp spawn codex --mode persistent --thread auto --cwd /repo |
/acp cancel | Cancel in-flight turn for target session. | /acp cancel agent:codex:acp:<uuid> |
/acp steer | Send steer instruction to running session. | /acp steer --session support inbox prioritize failing tests |
/acp close | Close session and unbind thread targets. | /acp close |
/acp status | Show backend, mode, state, runtime options, capabilities. | /acp status |
/acp set-mode | Set runtime mode for target session. | /acp set-mode plan |
/acp set | Generic runtime config option write. | /acp set model openai/gpt-5.2 |
/acp cwd | Set runtime working directory override. | /acp cwd /Users/user/Projects/repo |
/acp permissions | Set approval policy profile. | /acp permissions strict |
/acp timeout | Set runtime timeout (seconds). | /acp timeout 120 |
/acp model | Set runtime model override. | /acp model anthropic/claude-opus-4-5 |
/acp reset-options | Remove session runtime option overrides. | /acp reset-options |
/acp sessions | List recent ACP sessions from store. | /acp sessions |
/acp doctor | Backend health, capabilities, actionable fixes. | /acp doctor |
/acp install | Print deterministic install and enable steps. | /acp install |
Runtime options mapping
/acp has convenience commands and a generic setter.
Equivalent operations:
/acp model <id>maps to runtime config keymodel./acp permissions <profile>maps to runtime config keyapproval_policy./acp timeout <seconds>maps to runtime config keytimeout./acp cwd <path>updates runtime cwd override directly./acp set <key> <value>is the generic path.- Special case:
key=cwduses the cwd override path.
- Special case:
/acp reset-optionsclears all runtime overrides for target session.
acpx harness support (current)
Current acpx built-in harness aliases:piclaudecodexopencodegemini
agentId unless your acpx config defines custom agent aliases.
Direct acpx CLI usage can also target arbitrary adapters via --agent <command>, but that raw escape hatch is an acpx CLI feature (not the normal OpenClaw agentId path).
Required config
Core ACP baseline:- Discord:
channels.discord.threadBindings.spawnAcpSessions=true
Plugin setup for acpx backend
Install and enable plugin:Pinned acpx install strategy (current behavior)
@openclaw/acpx now enforces a strict plugin-local pinning model:
- The extension pins an exact acpx dependency in
extensions/acpx/package.json. - Runtime command is fixed to the plugin-local binary (
extensions/acpx/node_modules/.bin/acpx), not globalPATH. - Plugin config does not expose
commandorcommandArgs, so runtime command drift is blocked. - Startup registers the ACP backend immediately as not-ready.
- A background ensure job verifies
acpx --versionagainst the pinned version. - If missing/mismatched, it runs plugin-local install (
npm install --omit=dev --no-save acpx@<pinned>) and re-verifies before healthy.
- OpenClaw startup stays non-blocking while acpx ensure runs.
- If network/install fails, backend remains unavailable and
/acp doctorreports an actionable fix.
Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
ACP runtime backend is not configured | Backend plugin missing or disabled. | Install and enable backend plugin, then run /acp doctor. |
ACP is disabled by policy (acp.enabled=false) | ACP globally disabled. | Set acp.enabled=true. |
ACP dispatch is disabled by policy (acp.dispatch.enabled=false) | Dispatch from normal thread messages disabled. | Set acp.dispatch.enabled=true. |
ACP agent "<id>" is not allowed by policy | Agent not in allowlist. | Use allowed agentId or update acp.allowedAgents. |
Unable to resolve session target: ... | Bad key/id/label token. | Run /acp sessions, copy exact key/label, retry. |
--thread here requires running /acp spawn inside an active ... thread | --thread here used outside a thread context. | Move to target thread or use --thread auto/off. |
Only <user-id> can rebind this thread. | Another user owns thread binding. | Rebind as owner or use a different thread. |
Thread bindings are unavailable for <channel>. | Adapter lacks thread binding capability. | Use --thread off or move to supported adapter/channel. |
| Missing ACP metadata for bound session | Stale/deleted ACP session metadata. | Recreate with /acp spawn, then rebind/focus thread. |