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.
See also Sub-agents.
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.enabledis on by default (setfalseto pause ACP dispatch)- Channel-adapter ACP thread-spawn flag enabled (adapter-specific)
- Discord:
channels.discord.threadBindings.spawnAcpSessions=true - Telegram:
channels.telegram.threadBindings.spawnAcpSessions=true
- Discord:
Thread supporting channels
- Any channel adapter that exposes session/thread binding capability.
- Current built-in support:
- Discord threads/channels
- Telegram topics (forum topics in groups/supergroups and DM topics)
- Plugin channels can add support through the same binding interface.
Channel specific settings
For non-ephemeral workflows, configure persistent ACP bindings in top-levelbindings[] entries.
Binding model
bindings[].type="acp"marks a persistent ACP conversation binding.bindings[].matchidentifies the target conversation:- Discord channel or thread:
match.channel="discord"+match.peer.id="<channelOrThreadId>" - Telegram forum topic:
match.channel="telegram"+match.peer.id="<chatId>:topic:<topicId>"
- Discord channel or thread:
bindings[].agentIdis the owning OpenClaw agent id.- Optional ACP overrides live under
bindings[].acp:mode(persistentoroneshot)labelcwdbackend
Runtime defaults per agent
Useagents.list[].runtime to define ACP defaults once per agent:
agents.list[].runtime.type="acp"agents.list[].runtime.acp.agent(harness id, for examplecodexorclaude)agents.list[].runtime.acp.backendagents.list[].runtime.acp.modeagents.list[].runtime.acp.cwd
bindings[].acp.*agents.list[].runtime.acp.*- global ACP defaults (for example
acp.backend)
- OpenClaw ensures the configured ACP session exists before use.
- Messages in that channel or topic route to the configured ACP session.
- In bound conversations,
/newand/resetreset the same ACP session key in place. - Temporary runtime bindings (for example created by thread-focus flows) still apply where present.
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.streamTo(optional):"parent"streams initial ACP run progress summaries back to the requester session as system events.- When available, accepted responses include
streamLogPathpointing to a session-scoped JSONL log (<sessionId>.acp-stream.jsonl) you can tail for full relay history.
- When available, accepted responses include
Operator smoke test
Use this after a gateway deploy when you want a quick live check that ACP spawn is actually working end-to-end, not just passing unit tests. Recommended gate:- Verify the deployed gateway version/commit on the target host.
- Confirm the deployed source includes the ACP lineage acceptance in
src/gateway/sessions-patch.ts(subagent:* or acp:* sessions). - Open a temporary ACPX bridge session to a live agent (for example
razor(main)onjpclawhq). - Ask that agent to call
sessions_spawnwith:runtime: "acp"agentId: "codex"mode: "run"- task:
Reply with exactly LIVE-ACP-SPAWN-OK
- Verify the agent reports:
accepted=yes- a real
childSessionKey - no validator error
- Clean up the temporary ACPX bridge session.
- Keep this smoke test on
mode: "run"unless you are intentionally testing thread-bound persistent ACP sessions. - Do not require
streamTo: "parent"for the basic gate. That path depends on requester/session capabilities and is a separate integration check. - Treat thread-bound
mode: "session"testing as a second, richer integration pass from a real Discord thread or Telegram topic.
Sandbox compatibility
ACP sessions currently run on the host runtime, not inside the OpenClaw sandbox. Current limitations:- If the requester session is sandboxed, ACP spawns are blocked for both
sessions_spawn({ runtime: "acp" })and/acp spawn.- Error:
Sandboxed sessions cannot spawn ACP sessions because runtime="acp" runs on the host. Use runtime="subagent" from sandboxed sessions.
- Error:
sessions_spawnwithruntime: "acp"does not supportsandbox: "require".- Error:
sessions_spawn sandbox="require" is unsupported for runtime="acp" because ACP sessions run outside the sandbox. Use runtime="subagent" or sandbox="inherit".
- Error:
runtime: "subagent" when you need sandbox-enforced execution.
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.
Notes:
- On non-thread binding surfaces, default behavior is effectively
off. - Thread-bound spawn requires channel policy support:
- Discord:
channels.discord.threadBindings.spawnAcpSessions=true - Telegram:
channels.telegram.threadBindings.spawnAcpSessions=true
- Discord:
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
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:piclaudecodexopencodegeminikimi
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:acpx command and version configuration
By default, the acpx plugin (published as@openclaw/acpx) uses the plugin-local pinned binary:
- Command defaults to
extensions/acpx/node_modules/.bin/acpx. - Expected version defaults to the extension pin.
- Startup registers ACP backend immediately as not-ready.
- A background ensure job verifies
acpx --version. - If the plugin-local binary is missing or mismatched, it runs:
npm install --omit=dev --no-save acpx@<pinned>and re-verifies.
commandaccepts an absolute path, relative path, or command name (acpx).- Relative paths resolve from OpenClaw workspace directory.
expectedVersion: "any"disables strict version matching.- When
commandpoints to a custom binary/path, plugin-local auto-install is disabled. - OpenClaw startup remains non-blocking while the backend health check runs.
Permission configuration
ACP sessions run non-interactively — there is no TTY to approve or deny file-write and shell-exec permission prompts. The acpx plugin provides two config keys that control how permissions are handled:permissionMode
Controls which operations the harness agent can perform without prompting.
nonInteractivePermissions
Controls what happens when a permission prompt would be shown but no interactive TTY is available (which is always the case for ACP sessions).
Configuration
Set via plugin config:Important: OpenClaw currently defaults topermissionMode=approve-readsandnonInteractivePermissions=fail. In non-interactive ACP sessions, any write or exec that triggers a permission prompt can fail withAcpRuntimeError: Permission prompt unavailable in non-interactive mode. If you need to restrict permissions, setnonInteractivePermissionstodenyso sessions degrade gracefully instead of crashing.