Model Context Protocol (MCP) connects an agent to tools and data. Agent Client Protocol (ACP) solves the opposite boundary: it connects an editor or workstation client to an agent while the client retains ownership of the local filesystem and terminal. Whenever the agent needs to read a file or run a command, it requests access explicitly through ACP messages such as fs/read_text_file and session/request_permission.
Ferrite provides ACP v1 through the acp source package and exposes an /acp face on applications built with the Agent SDK.
Add the acp package
Install the host-free ACP v1 source package into your application:
ferrite add acp
acp compiles cleanly under Ferrite’s single-dependency rule (ferrite-app only) with zero network, clock, or entropy preconditions. Every external value arrives as an explicit parameter, so protocol state transitions are deterministic and testable offline.
Package modules and protocol roles
| Module | Role |
|---|---|
proto.rs | Bidirectional JSON-RPC 2.0 envelope, strict CallId vs notification separation, per-entry batch handling |
transport.rs | HTTP/SSE and WebSocket binding, connection IDs (Acp-Connection-Id), and resolve_route session routing |
schema.rs | ACP v1 wire types matching the normative v1 JSON schema, including presence-encoded capabilities ({} vs absent) |
agent.rs | Agent role covering the 13 methods an editor or client invokes (initialize, session creation, prompts, cancellation) |
client.rs | Client role covering the 11 callback methods an agent invokes on the editor (fs/read_text_file, session/request_permission, terminal requests) |
session.rs | Session lifecycle and per-connection state management |
Expose /acp through the Agent SDK
If your application already embeds a durable agent with agent-sdk, mount the SDK’s ACP face to map each ACP session onto a durable agent thread. Forward the connection and authorization headers in ferrite.json:
{
"prefix": "/acp",
"binding": "requests",
"kind": "api",
"forward_headers": ["authorization", "content-type", "accept", "acp-connection-id"]
}
See Agent API for how /acp sits alongside the Thread API, /mcp, and /a2a on the same embedded agent runtime.
Safety guarantees and host responsibilities
- Session routing fails closed.
transport::resolve_routereturns aResultand is the only public routing entry point. Asession/promptmissing a valid session identifier is rejected rather than leaking onto the connection-wide stream. - Deterministic connection IDs. Identifiers are derived as a digest over host-supplied inputs (such as subject, timestamp, and correlation ID) so a redelivered
initializerequest converges on the same connection instead of opening a duplicate session. - Per-entry batch handling. JSON-RPC batches validate and answer each member independently so one malformed entry never discards valid sibling requests.
- Host supplies transport, authentication, and persistence. The
acpsource package implements the wire protocol and session state machine only. Your application supplies caller authentication (failing closed when credentials are missing or unconfigured), attaches theAcp-Connection-Idresponse header oninitialize, and persists session state in your app’s store.
Next steps
- Wire
/acp,/mcp, and/a2aonto a single embedded agent in Agent API. - Compare ACP with remote agent delegation in Agent Cards and A2A.
- Build an embedded durable agent with Agent SDK.