Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Conductor Design

The agent-client-protocol-conductor crate runs a chain of ACP proxy components. It presents one ACP endpoint upstream while owning the connections to every proxy and, in agent mode, the final agent.

For API details, see the agent-client-protocol-conductor rustdoc.

Chain Model

flowchart LR
    Client[ACP client]
    Conductor[Conductor]
    Proxy1[Proxy 1]
    Proxy2[Proxy 2]
    Agent[Agent]

    Client <--> Conductor
    Conductor <--> Proxy1
    Conductor <--> Proxy2
    Conductor <--> Agent

Components do not open direct connections to one another. The conductor owns each transport and maps the logical chain onto those connections:

  • Upstream traffic is delivered to the first proxy as ordinary ACP messages.
  • A proxy uses proxy/successor to send a request or notification to the next component.
  • Traffic from a successor is presented to its predecessor through the same typed proxy abstraction.
  • JSON-RPC responses remain paired with the request context that caused them.

Cancellation is hop-local. A $/cancel_request names a request on the connection it arrives on, so the conductor never forwards one. When a request it forwarded is cancelled, it sends its own $/cancel_request to the next component with that hop’s request ID. It accepts a proxy’s cancellation of a proxy/successor request both plain, as the SDK’s proxies send it, and wrapped in proxy/successor.

proxy/successor is exchanged only between the conductor and the proxies it initialized, and between a conductor in proxy mode and its own conductor. The conductor answers a proxy/successor request from the agent, or from the client of a conductor in agent mode, with -32600 (Invalid request), and drops and logs such a notification. It does the same for a proxy/successor that a proxy, or the conductor of a conductor in proxy mode, wraps in a second proxy/successor. Forwarding any of these would deliver it to a proxy as a message from that proxy’s successor.

The final agent receives ordinary ACP and does not need to implement the proxy extension. See the Proxy Extension Protocol Reference for the wire method shapes. The conductor uses proxy/initialize and proxy/successor from the ACP proxy chains RFD, with the message types and method names from agent-client-protocol-schema (its unstable_proxy_chains feature, which the SDK always enables). Earlier releases used _proxy/initialize and _proxy/successor, so upgrade conductors and proxies together (see Migrating to v5).

The conductor and the default proxy forwarding return the result or error of every wrapped request unchanged, as the RFD requires: they forward responses without re-wrapping them, rewriting error codes, or re-encoding results through typed schema structs. See Results and errors for the limits of that guarantee.

Lazy Initialization

Proxy and agent components are instantiated when the first initialize request arrives. For each non-final component, the conductor sends proxy/initialize; the last component in agent mode receives ordinary initialize. Each proxy can initialize its successor before completing its own response, so capabilities flow back toward the client through the chain.

Lazy construction allows an InstantiateProxiesAndAgent or InstantiateProxies implementation to inspect and, when appropriate, adjust the initialize request before choosing components.

Initialization selects the protocol version from the raw protocolVersion before deserialization, so v2 info, capabilities, metadata, and future extension fields are never interpreted as a permissive v1 request. With the conductor crate’s unstable_protocol_v2 feature, a request for v2 or newer selects v2; every other request selects v1, keeping v1’s fallback-to-latest rule. A request for a newer version than the selected one keeps only what parses under the selected version. A conductor in proxy mode negotiates its proxy/initialize the same way. The instantiator receives a SelectedInitializeRequest for the selected version. An unchanged request for exactly the selected version keeps its original raw parameters, including unknown extensions; a modified typed request is serialized as the new authoritative payload, while its protocolVersion remains pinned to the selected version.

The selected version is the highest version the chain may speak. Proxies negotiate proxy/initialize the way agents negotiate initialize: a v1 proxy answers a request for v2 or newer as v1 and initializes its successor with v1, and a v2 proxy keeps what parses under v2 for a newer request and rejects a request below v2 with -32022. So a proxy that supports only a lower version narrows the rest of the chain to that version, and the initialize response the client receives carries the version every component accepted. A component that cannot accept the narrowed version, such as a v2-only agent behind a v1-only proxy, or a v2-only proxy whose successor answers with v1, rejects the initialization, and the client sees that error.

The command-line component provider, AgentOnly, ProxiesAndAgent, and static proxy vectors use their components for every version, so each supplied component must support the selected version. Use Agent.protocol_router() or Proxy.protocol_router() when a static component has separate implementations. A custom instantiator that supports only a lower version negotiates down by returning the request for that version (for example with SelectedInitializeRequest::into_v1), and the client receives an initialize response for it. An instantiator returns InstantiatedChain (agent mode) or InstantiatedProxies (proxy mode). An instantiator error answers the initialize request and leaves the connection in a failed state that rejects later traffic. A first message that is not a valid initialization is answered with an error and leaves the conductor uninitialized, so the client can retry.

Forwarding

Forwarding is the same for every protocol version and does not depend on the feature: proxy/initialize has the same wire shape in v1 and v2. The conductor rejects a proxy/initialize that arrives from outside, renames initialize to proxy/initialize for the first proxy with its params untouched, and preserves fields it doesn’t recognize.

Each hop allocates a new JSON-RPC ID. When an agent sends a request-scoped elicitation/create, each forwarding hop translates params.requestId back to the ID its predecessor used. A reference with no matching live forwarded request on that hop is answered with -32602 (Invalid params), not passed through. The callback’s own ID and response use normal request routing; session-scoped elicitations, tool-call IDs and nested MCP payloads are unchanged.

The conductor’s connections to its client and to the final agent, and the pass-through proxy it inserts for tracing, have no protocol version guard; the endpoints validate the traffic of the negotiated version.

Agent and Proxy Modes

In agent mode, the conductor owns zero or more proxies followed by a final agent and acts as an agent toward its upstream client.

In proxy mode, the conductor owns only a proxy sub-chain. The final managed proxy’s successor is the conductor’s own downstream successor, allowing a sub-chain to participate as one proxy inside a larger composition.

Routing and Ordering

A central routing loop serializes forwarding decisions for incoming requests and notifications. Responses are associated with their original requests by the core JSON-RPC contexts and may use a direct response path; the conductor does not maintain a second global request-ID table.

Every physical and in-process bridge carries TransportFrame, so tracing and delegating components relay each wire value, including malformed input, unchanged. JSON-RPC batches are not supported; see Transport Architecture.

Command-Line Usage

Global options precede the subcommand. Each component argument is one shell-parsed command string, so quote commands that include arguments:

agent-client-protocol-conductor agent \
  "proxy-one --flag" \
  "proxy-two" \
  "base-agent --acp"

The last command in agent mode is the agent; earlier commands are proxies. Proxy mode accepts only proxy commands:

agent-client-protocol-conductor proxy "proxy-one" "proxy-two"

Tracing options are global:

agent-client-protocol-conductor --trace ./trace.jsons agent "proxy-one" "base-agent"
agent-client-protocol-conductor --serve agent "proxy-one" "base-agent"
agent-client-protocol-conductor --trace ./trace.jsons --serve agent "proxy-one" "base-agent"

Build the opt-in binary with draft-v2 proxy initialization enabled using:

cargo build -p agent-client-protocol-conductor --features unstable_protocol_v2

There is no conductor mcp subcommand. Compatibility for HTTP-capable agents that lack the native ACP MCP transport lives in agent-client-protocol-polyfill and must be inserted explicitly when needed.

Programmatic Usage

use agent_client_protocol_conductor::{ConductorImpl, ProxiesAndAgent};

let components = ProxiesAndAgent::new(agent)
    .proxy(first_proxy)
    .proxy(second_proxy);

ConductorImpl::new_agent("conductor", components)
    .run(upstream_transport)
    .await?;

ConductorImpl::new_proxy accepts an InstantiateProxies implementation for the nested-proxy case. Both modes can use dynamic instantiator closures that receive the SelectedInitializeRequest when the chain depends on initialization data.

MCP Compatibility

MCP-over-ACP adaptation is intentionally not built into ConductorImpl. Add McpOverAcpPolyfill::http() as a proxy in the chain immediately before a final agent that cannot consume native McpServer::Acp declarations. The provider-facing side uses feature-gated, request-scoped mcp/message operations for MCP 2026-07-28; only the final-agent side is adapted to HTTP. Keeping the polyfill explicit prevents instrumentation or orchestration from silently changing session MCP declarations. See MCP Bridge.

The polyfill supports v1 by default. For a draft-v2 chain, enable unstable_protocol_v2 on both the conductor and the polyfill crate; the conductor’s feature does not enable the polyfill’s. A polyfill built without the feature negotiates its proxy/initialize down to v1 like any v1-only proxy, so the whole chain, and the initialize response the client receives, use v1.

Tracing

The conductor can record an idealized logical sequence of ACP and MCP messages. Its snooping bridges retain complete transport frames, so enabling tracing does not change what is sent on the wire. See Trace Viewer for the event format and current CLI/API examples.