amazon-q-developer-cli icon indicating copy to clipboard operation
amazon-q-developer-cli copied to clipboard

Agent Client Protocol implementation

Open nikomatsakis opened this issue 3 months ago • 2 comments

Issue #, if available:

Description of changes:

Implement the Agent Client Protocol. Don't read this code yet, it's very messy and not finished; I plan to clean it up.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

--

RFC draft (motivation, high-level idea)

Summary

Add Agent Client Protocol (ACP) server capability to Amazon Q CLI, allowing editors like Zed and Neovim to use Q as an AI coding assistant through a standardized JSON-RPC interface.

What is ACP? Agent Client Protocol is a JSON-RPC standard that lets editors communicate with AI agents over stdio. Instead of building custom integrations for each editor, agents implement ACP once and work with any ACP-compatible editor.

User Experience: Users run q acp to start Q in server mode, then configure their editor to connect to this process. The editor handles the UI while Q provides the AI capabilities - same models, tools, and features as q chat.

Motivation

Problem: Currently Q CLI provides two options to users: an interactive, CLI-based chat interface and a non-interactive mode. But some use-cases demand interaction but in a programmatic or scripted fashion. This includes custom GUI in editors, automation tools, IDEs, web interfaces, and other applications. But right now each application must adapt to each agent independently. This means applications are likely only to build on the most widely used alternatives (e.g., with the Claude Code SDK, which provides programmatic access to the Claude Code agent).

Solution: ACP provides an alternative, using a JSON-RPC protocol inspired by MCP to let any application integrate with any agent, sending user input and receiving the agent's responses in a streaming fashion.

Immediate Benefits: This provides immediate value to Q CLI users by allowing them to access Q from editors that support ACP (Zed, Neovim) with native integration - same models, tools, and MCP servers, but in their preferred editor instead of switching to terminal.

Strategic Benefits: Supporting ACP also helps boost the protocol itself. The more editors and agents use ACP, the more likely it will succeed as a standard. This avoids the problem of tooling being built atop proprietary options like the Claude Code SDK, which would lock Q CLI out of future editor integrations.

Guide-level Explanation

Setup:

# Start Q in ACP server mode
q acp --agent my-profile

# Configure editor to connect to this process
# (Editor-specific configuration)

Usage: Once connected, users interact with Q through their editor's AI interface:

  • Chat with Q in editor panels/sidebars
  • Q can read/write files through the editor (sees unsaved changes)
  • Tool execution with editor-native permission prompts
  • Same models, agents, and MCP servers as terminal Q CLI

JSON-RPC Communication: Editor and Q communicate over stdio using structured messages:

// Editor → Q: User sends a message
{"method": "session/prompt", "params": {"sessionId": "123", "messages": [...]}}

// Q → Editor: Streaming response
{"method": "session/update", "params": {"sessionId": "123", "update": {"AgentMessageChunk": {...}}}}

nikomatsakis avatar Sep 26 '25 17:09 nikomatsakis

mentioning #2703 for tracking

dherman avatar Oct 07 '25 19:10 dherman

Closing in favor of #3347

nikomatsakis avatar Nov 19 '25 19:11 nikomatsakis