-
Notifications
You must be signed in to change notification settings - Fork 780
Description
Summary
Add native support for the Agent Client Protocol (ACP) to allow Copilot SDK to connect directly to ACP-compatible agents like Gemini CLI, without requiring a protocol translation proxy.
Problem
Currently, when using cliPath to specify a custom CLI (e.g., gemini), the SDK fails because it sends Copilot-specific CLI arguments (--headless, --stdio, --log-level) that ACP-compatible CLIs don't recognize.
// This doesn't work with Gemini CLI
const client = new CopilotClient({
cliPath: "gemini"
});Error:
Unknown arguments: server, log-level, logLevel, stdio
Root Cause: Protocol Incompatibility
Copilot SDK and ACP use different JSON-RPC method names and initialization flows:
| Feature | Copilot SDK Protocol | ACP Protocol |
|---|---|---|
| Initialize | ping |
initialize |
| Create Session | session.create |
session/new |
| Send Message | session.send |
session/prompt |
| Cancel | N/A | session/cancel |
| CLI Arguments | --headless --stdio --log-level |
--experimental-acp (Gemini) |
Current Workaround
Users must build a protocol translation proxy that:
- Accepts Copilot SDK protocol over stdio
- Translates to ACP protocol
- Spawns and communicates with the ACP agent
Example implementation: claude-code-acp-py (PyPI) - A Python proxy that bridges Copilot SDK to ACP-compatible backends (Gemini CLI, Claude Code ACP, etc.)
This adds complexity and maintenance burden.
Proposed Solution
Add an option to specify the protocol type when creating a client:
// Option 1: New protocol parameter
const client = new CopilotClient({
cliPath: "gemini",
protocol: "acp", // or "copilot" (default)
cliArgs: ["--experimental-acp"]
});
// Option 2: Auto-detect based on initialization response
const client = new CopilotClient({
cliPath: "gemini",
cliArgs: ["--experimental-acp"],
autoDetectProtocol: true
});Use Cases
- Gemini CLI Integration: Use
gemini --experimental-acpdirectly with Copilot SDK - Claude Code ACP: Connect to
claude-code-acpimplementations - Custom Agents: Support any ACP-compatible agent without proxy overhead
- Ecosystem Interoperability: ACP is becoming a standard for AI agent communication (supported by Zed, Neovim, etc.)
References
- ACP Specification
- ACP GitHub
- Gemini CLI ACP Support - Lists Gemini CLI as ACP-compatible
- Claude Code ACP Request (anthropics/claude-code#6686) - 434+ upvotes showing community demand
- claude-code-acp-py - Protocol translation proxy (workaround implementation)
Environment
- SDK: Node.js / Python / Go / .NET (all affected)
- Tested with: Gemini CLI v1.x with
--experimental-acp