Bennet Fenner from Zed demonstrates building an ACP-compatible AI coding agent by extending a minimal TypeScript agent to implement the Agent Client Protocol, enabling standardized communication, session management, and streaming responses with tools like file operations and terminal commands. This integration allows seamless interaction between the agent and the Zed editor, enhancing real-time collaboration and synchronization, with the open-source protocol supporting multiple clients and agents.
Bennet Fenner from Zed presents a live coding session demonstrating how to build an ACP (Agent Client Protocol)-compatible AI coding agent. Zed is an AI code editor written in Rust, and with the rise of AI coding agents from various providers, Zed aimed to create a unified interface allowing users to bring their preferred agents into their tool. To achieve this, they developed ACP, a JSON RPC-based protocol similar to MCP or LSP, enabling agents and clients to communicate through a standardized interface. The protocol is open source and already supported by numerous agents and clients, including OpenAI’s OpenClaw, JetBrains, and Obsidian.
Bennet begins by showing a minimal coding agent written in TypeScript that supports basic file reading and editing tools but is not yet ACP-compatible. The agent interacts with the Anthropic API in a stateless manner, maintaining conversation context locally and handling tool calls such as reading or writing files. The core loop involves sending prompts to the model, receiving responses, and executing tool calls as needed. The goal is to extend this minimal agent to support ACP by implementing key protocol functions like initialization, session management, prompting, and cancellation.
To make the agent ACP-compatible, Bennet implements the required interface functions, including initializing the protocol version, managing sessions with unique IDs, and handling prompt requests linked to sessions. He integrates the Anthropic SDK’s streaming capabilities to send incremental output chunks as ACP session updates, allowing the client (Zed) to display streaming responses in real time. This enhancement improves the user experience by showing live token output rather than waiting for the entire response.
Next, Bennet extends the agent’s tool support to handle file reading and writing through ACP session updates. Instead of directly accessing the file system, the agent proxies file operations over ACP, enabling it to see unsaved changes in the client’s buffer. He demonstrates emitting session updates to indicate tool call progress and completion, including sending diffs for file edits. This approach allows the agent to interact more seamlessly with the client’s environment and maintain synchronization between the agent’s view and the editor’s state.
Finally, Bennet showcases adding a terminal tool to the agent, enabling it to run shell commands via the client’s terminal capabilities advertised through ACP. He live-codes this feature, compiles, and tests it by running a simple command, demonstrating the agent’s expanded interactivity. The session concludes with Bennet inviting viewers to explore ACP further at agentclientprotocol.com and noting that the demo code will be uploaded soon, emphasizing that it is experimental and not production-ready. The protocol currently operates over standard IO, with plans for remote transport support underway.