ACP Agents
The Agent Client Protocol (ACP) is an open protocol between clients and coding agents. Instead of starting a CLI, a harness.run step can act as an ACP client: it opens a session, sends the prompt, answers the agent's permission requests, and captures the agent's reply as step stdout.
Select ACP with protocol: acp in a named custom harness definition. The agent runs in one of three places:
transport | Agent runs | Endpoint |
|---|---|---|
stdio (default) | On the Dagu host, as a local adapter process | binary |
websocket | On another host | ws:// or wss:// URL |
http | On another host, behind ACP Streamable HTTP | http:// or https:// URL |
Local Adapter
Install and authenticate an ACP adapter on the host that runs the step, such as codex-acp from npm install -g @agentclientprotocol/codex-acp:
working_dir: /srv/repos/app
harnesses:
coding-agent:
protocol: acp
binary: codex-acp
steps:
- id: review
action: harness.run
with:
provider: coding-agent
prompt: Summarize the modules in this repository without modifying files.
output: REVIEW- The adapter process inherits the step's environment, working directory, and resource limits. The session's working directory is the step's.
binary,prefix_args,flag_style, andoption_flagscontrol how the adapter starts. Otherwithkeys become adapter CLI flags, as described in Passing Options.- The prompt travels over the protocol, so ACP definitions reject
prompt_mode,prompt_flag, andprompt_position.with.stdinis appended to the prompt after a blank line.
Remote Agent
A remote definition connects to an agent that another host runs. It needs a url and cwd, the absolute working directory on the agent host:
working_dir: /srv/repos/app
harnesses:
remote-agent:
protocol: acp
transport: websocket # http for an ACP Streamable HTTP endpoint
url: wss://acp.example.com/acp
cwd: /srv/project
headers:
Authorization: Bearer ${ACP_TOKEN}
steps:
- id: review
action: harness.run
timeout_sec: 600
with:
provider: remote-agent
prompt: Review the project without modifying files.
output: REVIEW- A remote step accepts only
provider,fallback, andacp_permissionunderwith. Any other key fails the step, because a remote agent takes no CLI flags. binary,prefix_args,flag_style, andoption_flagsare rejected in a remote definition.url,cwd,headers, andca_fileaccept workflow variables. Aurlorcwdwith a variable is validated after it resolves.- Dagu passes
cwdto the agent as written. It never creates or translates the remote directory. - Certificate and hostname verification always stay on.
ca_fileadds PEM roots for this connection, alongside the system roots; a relative path resolves from the step's working directory. - Redirects are refused, and network errors omit credentials and response bodies.
- Headers sent over
ws://orhttp://to a non-loopback host produce a warning in the step log.
Keep tokens in secrets rather than in the DAG file.
WebSocket
The WebSocket transport offers the acp.v1 subprotocol, sends headers with the upgrade request, and uses ping frames to keep idle connections open through proxies.
Bearer tokens stay in the Authorization header. Set bearer_subprotocol: true only for a bridge that requires the token as a bearer.<token> subprotocol; the token must then be a valid HTTP token, so tokens containing / or = cannot use it.
Streamable HTTP
transport: http follows the experimental Streamable HTTP profile of the ACP TypeScript SDK. The endpoint must implement that profile: initialize returns JSON with an Acp-Connection-Id header, later POSTs return 202 Accepted, and replies and agent requests arrive on server-sent event streams. Dagu keeps cookies for affinity and deletes the connection when the step ends. This is not the MCP Streamable HTTP transport.
Definition Fields
| Field | Applies to | Description |
|---|---|---|
protocol | all | acp selects ACP; cli or omitted keeps CLI invocation |
transport | ACP | stdio (default), websocket, or http |
binary | stdio | Adapter binary name or path; required |
prefix_args | stdio | Arguments placed before generated flags |
flag_style | stdio | gnu_long or single_dash for generated flags |
option_flags | stdio | Exact flag per with key |
url | remote | Endpoint: ws:///wss:// for WebSocket, http:///https:// for HTTP; required |
cwd | remote | Absolute working directory on the agent host; required |
headers | remote | Request headers, such as Authorization |
ca_file | remote | Extra PEM certificate roots for this connection |
bearer_subprotocol | WebSocket | Also send the bearer token as a bearer.<token> subprotocol; default false |
Permissions
ACP agents ask the client before running tools that need approval. with.acp_permission sets the answer:
| Value | Behavior |
|---|---|
deny (default) | Selects the agent's reject option and fails the attempt, even if the agent then ends its turn normally |
allow | Selects an offered allow_once option; never grants persistent approval |
With allow, a request that offers no allow_once option is still rejected and fails the attempt.
working_dir: /srv/repos/app
harnesses:
coding-agent:
protocol: acp
binary: codex-acp
steps:
- id: fix
action: harness.run
with:
provider: coding-agent
acp_permission: allow
prompt: Fix the failing unit test.This policy answers the protocol's permission requests only. It is not a sandbox around the agent's own tools; use a remote host or the agent's own sandbox settings for isolation.
Output
The agent's message text becomes step stdout, so it works with output:, outputs:, and output_schema. Protocol messages, thoughts, and tool events are left out. The step succeeds only when the agent ends its turn with end_turn; any other stop reason, such as a refusal, fails the attempt.
Each execution opens a new session.
DAG-Level Defaults
DAG-level harness: defaults apply to ACP steps, with two differences:
- A remote ACP step inherits only
providerandacp_permission, also when a variable such as${PROVIDER}selects the provider. acp_permissionaffects only ACP steps. CLI providers never receive it as a flag, so one DAG can set it alongside CLI steps.
working_dir: /srv/repos/app
harnesses:
remote-agent:
protocol: acp
transport: http
url: https://acp.example.com/acp
cwd: /srv/project
harness:
provider: claude
model: sonnet
acp_permission: allow
steps:
- id: local_review
action: harness.run
with:
prompt: Review the staged changes.
- id: remote_review
action: harness.run
with:
provider: remote-agent
prompt: Review the deployment manifests.local_review runs Claude Code with --model sonnet. remote_review gets acp_permission: allow but not model.
Stopping and Timeouts
| Event | Behavior | Exit code |
|---|---|---|
| Stop | Sends session/cancel and waits for the agent to end its turn | 143, or 128 + the signal number |
Forced stop, including when max_clean_up_time_sec elapses | Sends session/cancel, then ends the local process tree or closes the remote connection | 137 |
timeout_sec reached | Sends session/cancel, then interrupts the transport | 124 |
A stop skips the remaining fallback providers, even when it arrives while the agent is still starting. A remote agent must honor session/cancel; Dagu closes the connection but does not own the remote process.
When a local adapter crashes or exits after a failed turn, the step keeps the adapter's exit code, so retry_policy and continue_on rules can match it. Recent adapter stderr is included in the error.
Fallbacks
ACP and CLI providers can share one fallback list. Text from a failed attempt never reaches the output of a later successful attempt.
working_dir: /srv/repos/app
harnesses:
coding-agent:
protocol: acp
binary: codex-acp
steps:
- id: review
action: harness.run
with:
provider: coding-agent
prompt: Review this repository.
fallback:
- provider: claudeLimits
- Adapters must be installed and authenticated beforehand; interactive authentication is not available.
- ACP steps cannot run in a container. A step-level
container:fails the step; a DAG-levelcontainer:fails local adapters and is ignored by remote agents. - The client does not offer filesystem or terminal callbacks to the agent.
- Sessions are not resumed, and a dropped connection is not reconnected or replayed.
- ACP agents do not report model usage; the step records the provider under
notReported.
Need one of these? Request it.
Related
- Harness: step contract, fallbacks, and DAG-level defaults
- Hermes Agent: also available as an ACP agent with
hermes acp - Agent Client Protocol

