Langcli logoAI Coding Assistant
ACP Integration

What is ACP

Learn what ACP is

Overview

ACP (Agent Client Protocol) is a standardized stdio protocol that allows IDEs and editors to drive an AI Agent via NDJSON streams over stdin/stdout. Langcli implements a full ACP agent endpoint that can be directly invoked by ACP-supporting clients such as Zed, Cursor, VSCode, and others.

Core Features

  • Session Management: Create / Resume / Load / Fork / Close sessions
  • History Replay: Automatically load and replay conversation history when resuming a session
  • Permission Bridging: Map ACP client permission decisions to Langcli's tool permission system
  • Slash Commands & Skills: Load the real command list, supporting prompt-type skills like /commit, /review
  • Context Window Tracking: Precise usage_update with model prefix matching
  • Prompt Queuing: Support sending multiple prompts concurrently with automatic queue processing
  • Mode Switching: auto / default / acceptEdits / plan / dontAsk / bypassPermissions
  • Model Switching: Switch AI models at runtime

Architecture

┌──────────────┐    NDJSON/stdio    ┌─────────────────────────┐
│  Zed / IDE   │ ◄────────────────► │  Langcli ACP Agent      │
│  (Client)    │   stdin / stdout   │  (Agent)                │
└──────────────┘                    │                         │
                                    │  entry.ts               │ ← stdio → NDJSON stream
                                    │  agent.ts               │ ← ACP protocol handler
                                    │  bridge.ts              │ ← SDKMessage → ACP SessionUpdate
                                    │  permissions.ts         │ ← Permission bridging
                                    │  utils.ts               │ ← Utilities
                                    │                         │
                                    │  QueryEngine            │ ← Internal query engine
                                    └─────────────────────────┘

ACP Protocol Support Matrix

MethodStatusDescription
initializeReturn agent info and capabilities
authenticateNo authentication required (self-hosted)
newSessionCreate a new session
resumeSessionResume an existing session (with history replay)
loadSessionLoad a specified session (with history replay)
listSessionsList available sessions
forkSessionFork a session
closeSessionClose a session
promptSend a message with queue support
cancelCancel current/queued prompts
setSessionModeSwitch permission mode
setSessionModelSwitch AI model
setSessionConfigOptionDynamically modify configuration

SessionUpdate Types

TypeStatusDescription
agent_message_chunkAssistant text message
agent_thought_chunkThought/reasoning content
user_message_chunkUser message (history replay)
tool_callTool call started
tool_call_updateTool call result/status update
usage_updateToken usage + context window
planTodoWrite → plan entries
available_commands_updateSlash commands & skills list
current_mode_updateMode switch notification
config_option_updateConfig update notification

Last Updated