Skip to main content
A pure Java implementation of the Agent Client Protocol (ACP) specification. Build clients that connect to ACP agents, or build agents that run inside code editors.

How ACP Works

ACP uses a subprocess model. A client (your application, or an editor like Zed) launches an agent as a child process and communicates over stdin/stdout using JSON-RPC messages. The protocol has three phases:
  1. Initialize — client and agent exchange protocol versions and capabilities
  2. Session — client creates a session with a working directory context
  3. Prompt — client sends messages, agent streams back responses
This is the same mechanism that Zed, JetBrains, and VS Code use to talk to AI agents. The SDK lets you build either side of that conversation.

Overview

The ACP Java SDK provides:
  • Client SDK — connect to and interact with any ACP-compliant agent
  • Agent SDK — build ACP-compliant agents that work in Zed, JetBrains, and VS Code
  • Test utilities — in-memory transports for fast, deterministic testing

Quick Start

Try it now

The fastest way to see ACP in action is to clone the tutorial and run a module. The client example talks to Gemini CLI (requires GEMINI_API_KEY). The agent example runs locally with no API key.

Client — Connect to an Agent

This example launches Gemini CLI as an ACP agent subprocess and sends it a prompt. Any CLI tool that speaks ACP over stdin/stdout works here — Gemini CLI is one such tool. AgentParameters builds the command line (gemini --experimental-acp). StdioAcpClientTransport spawns the process and handles the JSON-RPC framing. The sessionUpdateConsumer receives the agent’s response text as it streams in — without it, you’d get the stop reason but no visible output.
Run this yourself: Module 01: First Contact — full source with error handling and setup.

Agent — Build Your Own

This is the other side of the conversation. When you build an agent, editors and clients launch your code as a subprocess and send it JSON-RPC messages over stdin. Your agent handles three request types: initialize, new session, and prompt. The stdio transport reads from stdin and writes to stdout. run() blocks until the client disconnects. The module includes a demo client that launches this agent as a subprocess and exercises it — you’ll see Echo: Hello! printed when you run it.
Run this yourself: Module 12: Echo Agent — includes a demo client that launches the agent and sends test prompts. No API key required.

Adding the SDK to your project

For annotation-based agents (as shown above), add acp-agent-support instead — it includes acp-core transitively:
Version 0.12.0 added session/list, session/close, session/resume, elicitation, session/fork, and session/set_config_option. Version 0.14.0 (superseding the never-released 0.13.0) adds logout, session/delete, additional workspace directories, per-chunk message IDs, and the unstable providers/* configuration methods, promotes session/set_config_option to stable, and deprecates the removed session/set_model API (use session/set_config_option with a "model" category option). See the API Reference for installation.

Three Agent API Styles

All three styles produce identical protocol behavior. Choose based on programming preference.

Documentation

API Reference

Client API, Agent API (all three styles), protocol types, transports, errors

Tutorial

30-module progressive tutorial from client basics to IDE integration

Resources

ACP Ecosystem

Other ACP SDKs

Editor Documentation