What is ACP? Claude Code, Codex, Cursor and Grok Build
By Flavio
ACP is how an editor drives a coding agent over stdin and stdout. Cursor and Grok Build speak it. Claude Code and Codex document a different programmatic path.
ACP (Agent Client Protocol) is how an editor drives a coding agent as a child process. The editor writes JSON-RPC on the agent’s stdin. The agent writes responses on stdout. You stay in the editor. The agent still does the file and shell work.
Unlike MCP (where an agent calls a tool server), ACP lets an editor call an agent, while headless mode handles one-shot prompts with no editor in between.
How ACP works
The editor spawns the agent binary with an ACP argument. Messages are JSON-RPC 2.0, one JSON object per line. Logs can go to stderr, so they stay out of the protocol stream.
A typical session starts with initialize and authentication, opens or resumes a session (session/new or session/load), and sends user text via session/prompt. As the model streams, assistant text arrives as session/update notifications, tool approvals pause on session/request_permission, and session/cancel stops an active turn.
If the client never answers a permission request, the tool call sits there. ACP does not skip the approval the interactive CLI would have asked for.
ACP in each tool
Cursor and Grok Build document an ACP server command. Claude Code and Codex document other ways for a program to drive the agent. Those other ways are not described as ACP.
| Claude Code | Codex | Cursor | Grok Build | |
|---|---|---|---|---|
| ACP command | Not documented | Not documented | agent acp | grok agent stdio |
| Transport | Not documented | Not documented as ACP | stdio, newline-delimited JSON-RPC 2.0 | stdin and stdout, JSON-RPC |
| Auth the page names | Not documented | Not documented as ACP | cursor_login, or a key you passed at startup | A local login, or XAI_API_KEY |
| Where assistant text arrives | Not documented | Not documented as ACP | session/update | session/update chunks. session/prompt returns completion metadata |
Claude Code
Claude Code’s docs index does not list ACP. The programmatic interface it does document is headless mode: claude -p, or the Agent SDK. That is a prompt and a result. It is not a JSON-RPC session an editor attaches to.
See Claude Code headless mode.
OpenAI Codex
The Codex app-server page describes a JSON-RPC interface for rich clients, including the VS Code extension. Transports there include stdio. That page does not call the protocol ACP, and it does not list session/prompt or session/update. Treat app-server as its own interface. The page is Codex app-server.
Cursor
agent acp runs the CLI as an ACP server for custom clients or external editors (use plain agent for normal terminal sessions).
The flow sends initialize (protocolVersion: 1), authenticate (methodId: "cursor_login"), session/new or session/load, and session/prompt, streaming session/update events and answering permission requests with allow-once, allow-always, or reject-once.
Authenticate ahead of time via agent login or inline with --api-key/CURSOR_API_KEY or --auth-token/CURSOR_AUTH_TOKEN, using agent -e https://api2.cursor.sh acp for a custom endpoint and agent -k acp for TLS options.
Modes mirror the CLI (agent for full tools, plan for read-only planning, ask for read-only Q&A), and MCP servers load from project or user .cursor/mcp.json (dashboard team MCP servers aren’t supported in ACP).
Cursor also emits extension methods: blocking cursor/ask_question and cursor/create_plan requests plus cursor/update_todos, cursor/task, and cursor/generate_image notifications.
Zed can spawn agent acp. JetBrains and Neovim (avante.nvim) are the other editor examples on the page. The Neovim block points command at ~/.local/bin/agent, passes acp as the only argument, and sets auth_method to cursor_login.
See Cursor’s ACP docs.
Grok Build
grok agent stdio runs Grok as an ACP agent when another editor or app owns the UI, while terminal sessions stay on grok.
It assumes grok is already authenticated (or XAI_API_KEY is set), streaming assistant text via session/update chunks (sessionUpdate: "agent_message_chunk") and returning completion metadata from session/prompt.
Sessions are the same records the TUI and headless mode use, under ~/.grok/sessions/. In a script or in CI, pass --no-auto-update, or set auto_update = false under [cli] in ~/.grok/config.toml, so a background update check does not run.
How to use Grok Build shows this command alongside its JSON-RPC messages, and How to use fx covers another agent speaking ACP via fx acp.
See Grok Build headless and ACP.
Details checked against each vendor’s documentation in November 2026.
A real example
You want Neovim to drive Cursor’s agent, and you already ran agent login. The providers table from Cursor’s avante.nvim example is the piece that starts ACP:
acp_providers = {
cursor = {
command = os.getenv("HOME") .. "/.local/bin/agent",
args = { "acp" },
auth_method = "cursor_login",
},
},
The rest of that plugin spec, including provider = "cursor" and mode = "agentic", is on the ACP page. Adjust command if agent is not at ~/.local/bin/agent.
For Grok in a script, the documented launch is:
grok --no-auto-update agent stdio
CLI Tools Cabinet lists the agent binaries on the machine, which is the command an editor has to spawn. The CLI tools tutorial is the habit of reading that catalog before guessing a binary name.
When to use ACP
Use it when the editor is the UI and the coding agent should be a process it starts and stops. Cursor’s own examples are JetBrains, Neovim, and Zed. Grok’s page says the same thing in fewer words: IDE or tool integration, rather than a terminal session.
Use agent or grok when you are the client. Use headless mode when a script needs one answer and does not want to implement JSON-RPC.
Pitfalls
Printing raw stdout dumps protocol frames straight to the user unless your client parses each line for agent_message_chunk text and sends logs to stderr.
ACP skips dashboard team MCP servers in Cursor, so launch agent inside the project directory to pick up its local .cursor/mcp.json.
session/request_permission pauses tool execution, and auto-answering allow-once in an unattended client carries the same risk as auto-approving in the terminal.
Although Claude Code and Codex can both be scripted programmatically, neither documents Cursor’s ACP server methods, so wiring them as ACP servers fails.
Related on flaviocopes.com
- How to use Grok Build shows
grok agent stdioand howsession/updatediffers fromsession/prompt. - How to use fx shows
fx acpas the editor entry point for a different agent that speaks the same protocol. - Headless mode is the one-prompt programmatic path, for scripts that should not speak ACP.
- CLI Tools Cabinet catalogs the installed agent CLIs an editor would put in
command.
Related glossary entries
- Headless mode: Headless mode runs a coding agent from a script, with no chat UI. How claude -p, codex exec, the Cursor CLI and grok -p differ on permissions.
- Plugins: A plugin bundles skills, hooks and tools you install together. How plugins and marketplaces work in Claude Code, Codex, Cursor and Grok Build.
- Sessions: A session is a saved coding-agent conversation you can resume later. How Claude Code, Codex, the Cursor CLI and Grok Build store, name, resume and fork one.
- Slash commands: Slash commands are the /name controls inside a coding agent session. How they work in Claude Code, Codex, Cursor and Grok Build, and how to add your own.
All AI glossary entries → · AI for coding hub →
Want me to talk about your product? You can sponsor this site.