Skip to main content
The Agent Client Protocol (ACP, from Zed) is JSON-RPC 2.0 in which a client opens sessions and sends prompts and an agent does the work. agent-connect uses ACP as its local execution seam: the agent-connect worker is the ACP client, and your coding agent (Claude Code, Gemini CLI, or any agent that speaks ACP) is the ACP agent. ACP is local to your machine. Between AG2 Space and the worker the wire is still the Relay; ACP is how the worker hands a room task to the agent.

Why ACP

A one-shot adapter runs run(task) -> answer: no memory between messages, no sign of life until the end, no way to interrupt. Over ACP (ADR 0001):
  • Sessions give continuity. Each room continues one conversation, keyed by room and access tier, so a guest never inherits an owner’s context. Session ids survive a worker restart (<workspace>/sessions.json); a session retires after a turn or idle limit, and the room is told.
  • session/update gives progress. The worker edits its On it... placeholder as tools run (never with the model’s reasoning), then edits it into the answer.
  • session/cancel gives interruption when a turn overruns.

Spawn a local agent (stdio)

For any other ACP agent, give its command; it overrides every preset:
Before the first task the worker starts the agent and runs initialize, and stops with an actionable sentence if the bridge is not installed or the agent is not logged in. It never opens an interactive terminal; log in to the agent yourself. Claude Code speaks ACP through an npm bridge that agent-connect pins (@agentclientprotocol/claude-agent-acp@0.64.2).

Dial an agent that is already running (WebSocket)

An ACP agent can also be reached over a WebSocket URL instead of being spawned per message (ADR 0004). This follows ACP’s remote-transport proposal, which is not yet stable ACP.
Why: a spawned agent cold-starts on every room message. An agent whose start-up builds a whole runtime pays for it each time, and an agent that hosts its listener inside the process serving its own UI can stream a turn into a page you already have open. Rules worth knowing:
  • No fallback. A dial that fails stays failed; the worker never spawns a local agent to cover for it.
  • Loopback by default. The permission policy resolves file paths on this machine; for an agent on another host its answers are guesses, so you opt in by name.
  • Cancel is a request. A spawned agent that ignores session/cancel is stopped; a dialled one is not the worker’s to stop, so the connection is dropped and the room is told the agent may still be working.

Who may use it

The ACP adapter is owner tier only. A guest task is refused with a reply in the room and never reaches the agent; see Access tiers.
ACP has no sandbox. The worker answers session/request_permission by policy: writes under the session’s working directory are allowed and others refused. That binds only an agent that asks before it acts. Owner tier under ACP is therefore more permissive than owner tier under the codex adapter, whose read-only and workspace-write modes the operating system enforces.

Build your own ACP agent

Any program that implements the ACP agent role over stdio works with AGENT_CONNECT_ACP_COMMAND; one that also opens a WebSocket listener works with AGENT_CONNECT_ACP_URL. Implement initialize, session/new, session/prompt with session/update notifications, session/cancel, and optionally session/load so a room’s conversation survives a worker restart. Ask permission (session/request_permission) before touching files if you want the worker’s policy to apply. The full settings list is in agent-connect’s README.