[PR #191] [MERGED] feat(server): add ACP support #195

Closed
opened 2026-02-16 06:17:24 -05:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/langchain-ai/deepagentsjs/pull/191
Author: @christian-bromann
Created: 2/4/2026
Status: Merged
Merged: 2/25/2026
Merged by: @christian-bromann

Base: mainHead: cb/acp


📝 Commits (10+)

📊 Changes

25 files changed (+8263 additions, -845 deletions)

View changed files

.changeset/orange-scissors-tell.md (+5 -0)
examples/acp-server/README.md (+119 -0)
examples/acp-server/server.ts (+95 -0)
📝 examples/package.json (+1 -0)
libs/acp/README.md (+598 -0)
libs/acp/agent.json (+14 -0)
libs/acp/package.json (+84 -0)
libs/acp/src/acp-filesystem-backend.test.ts (+241 -0)
libs/acp/src/acp-filesystem-backend.ts (+91 -0)
libs/acp/src/adapter.test.ts (+583 -0)
libs/acp/src/adapter.ts (+256 -0)
libs/acp/src/cli.int.test.ts (+639 -0)
libs/acp/src/cli.ts (+332 -0)
libs/acp/src/index.ts (+73 -0)
libs/acp/src/logger.test.ts (+265 -0)
libs/acp/src/logger.ts (+301 -0)
libs/acp/src/server.int.test.ts (+378 -0)
libs/acp/src/server.test.ts (+1418 -0)
libs/acp/src/server.ts (+1392 -0)
libs/acp/src/types.ts (+264 -0)

...and 5 more files

📄 Description

This PR introduces the deepagents-acp package, enabling DeepAgents to integrate with IDEs like Zed, JetBrains, and other clients that support the Agent Client Protocol (ACP). This brings AI coding assistance directly into development environments through a standardized communication protocol.

Motivation

The Agent Client Protocol is emerging as a standard for how IDEs communicate with AI coding agents. By implementing ACP support, DeepAgents can now:

  • Run inside IDEs: Zed, JetBrains, and other ACP-compatible editors can launch and communicate with DeepAgents
  • Leverage native IDE features: File operations, terminal access, and workspace context are handled through the protocol
  • Provide real-time streaming: Agent responses, tool calls, and task progress stream directly to the IDE

What's Included

New Package: deepagents-acp

A complete ACP server implementation that wraps DeepAgents:

File Description
server.ts Core DeepAgentsServer class implementing the ACP protocol
cli.ts CLI entry point (npx deepagents-acp) with full option parsing
adapter.ts Bidirectional conversion between ACP ContentBlocks and LangChain messages
types.ts TypeScript types for agent configuration and ACP extensions
logger.ts Flexible logging utility supporting stderr and file output
index.ts Public API exports

ACP Protocol Implementation

Agent Methods:

  • initialize - Negotiate protocol version and capabilities
  • authenticate - Pass-through authentication
  • session/new - Create conversation sessions with mode selection
  • session/load - Resume existing sessions
  • session/prompt - Process user prompts with streaming responses
  • session/cancel - Cancel in-progress operations
  • session/set_mode - Switch between agent/plan/ask modes

Session Updates (Streaming):

  • agent_message_chunk - Stream text responses
  • agent_thought_chunk - Stream agent reasoning
  • tool_call / tool_call_update - Track tool execution
  • plan - Send task planning updates

CLI Features

npx deepagents-acp \
  --name my-agent \
  --model claude-sonnet-4-5-20250929 \
  --skills ./skills \
  --memory ./AGENTS.md \
  --log-file ./debug.log \
  --debug
  • Supports multiple argument formats for IDE compatibility (--name value, --name=value)
  • Environment variable configuration (ANTHROPIC_API_KEY, DEBUG, WORKSPACE_ROOT)
  • File-based logging for production debugging

Testing

Comprehensive test coverage:

Test File Type Tests
server.test.ts Unit Handler methods, configuration, error handling
server.int.test.ts Integration Session management, mode switching, cancellation
cli.int.test.ts CLI Integration Full protocol flow via spawned process
adapter.test.ts Unit Message format conversion
logger.test.ts Unit Logging behavior

Example

Added examples/acp-server/server.ts demonstrating programmatic usage with custom configuration.

Usage

With Zed

Add to ~/.config/zed/settings.json:

{
  "agent": {
    "profiles": {
      "deepagents": {
        "name": "DeepAgents",
        "command": "npx",
        "args": ["deepagents-acp", "--name", "my-agent", "--debug"],
        "env": {
          "ANTHROPIC_API_KEY": "sk-ant-..."
        }
      }
    }
  }
}

Programmatically

import { DeepAgentsServer, startServer } from "deepagents-acp";

// Quick start
await startServer({
  agents: { name: "my-agent", skills: ["./skills/"] }
});

// Or with full control
const server = new DeepAgentsServer({
  agents: [
    { name: "coder", model: "claude-sonnet-4-5-20250929" },
    { name: "reviewer", systemPrompt: "You are a code reviewer..." }
  ],
  debug: true,
  workspaceRoot: process.cwd(),
});
await server.start();

Architecture

┌─────────────────────────────────────────────────────────────┐
│                    IDE (Zed, JetBrains)                     │
│                      ACP Client                             │
└─────────────────────┬─���─────────────────────────────────────┘
                      │ stdio (JSON-RPC 2.0 / NDJSON)
                      ▼
┌─────────────────────────────────────────────────────────────┐
│                    deepagents-acp                           │
│   ┌─────────────────────────────────────────────────────┐   │
│   │           AgentSideConnection (ACP SDK)             │   │
│   └─────────────────────┬───────────────────────────────┘   │
│                         │                                   │
│   ┌─────────────────────▼───────────────────────────────┐   │
│   │              Message Adapter                        │   │
│   │   ACP ContentBlock ⟷ LangChain BaseMessage          │   │
│   └─────────────────────┬───────────────────────────────┘   │
│                         │                                   │
│   ┌─────────────────────▼───────────────────────────────┐   │
│   │               DeepAgent (LangGraph)                 │   │
│   │   Skills • Memory • Tools • Middleware              │   │
│   └─────────────────────────────────────────────────────┘   │
└─────────────────────────────────────────────────────────────┘

Future Improvements

  • MCP (Model Context Protocol) server support for tool discovery
  • HTTP/SSE transport (in addition to stdio)
  • Session persistence to disk
  • Multi-agent routing based on task type

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/langchain-ai/deepagentsjs/pull/191 **Author:** [@christian-bromann](https://github.com/christian-bromann) **Created:** 2/4/2026 **Status:** ✅ Merged **Merged:** 2/25/2026 **Merged by:** [@christian-bromann](https://github.com/christian-bromann) **Base:** `main` ← **Head:** `cb/acp` --- ### 📝 Commits (10+) - [`47bfd47`](https://github.com/langchain-ai/deepagentsjs/commit/47bfd47643657886c0ace396772e0094b0094921) feat(server): add ACP support - [`117715e`](https://github.com/langchain-ai/deepagentsjs/commit/117715ecf673a2cbbbdffca2987b46b2b5ad0fa3) improvements - [`57710fe`](https://github.com/langchain-ai/deepagentsjs/commit/57710fead18196701b68eaf05481fea9cb948997) rename to deepagents-acp - [`27c59f3`](https://github.com/langchain-ai/deepagentsjs/commit/27c59f3e85274c0068bcc5555438e59872e24793) format - [`9d63e3e`](https://github.com/langchain-ai/deepagentsjs/commit/9d63e3efd6ec697a99edef3c8ab7fea1d3cd6c7c) add missing props - [`d196836`](https://github.com/langchain-ai/deepagentsjs/commit/d19683695c58a285390a4b68383ef97ec5e87e47) linting - [`919ada3`](https://github.com/langchain-ai/deepagentsjs/commit/919ada3cd6dba1c298cf472f142280a4fc69b0e0) lint - [`a8a5851`](https://github.com/langchain-ai/deepagentsjs/commit/a8a58511bdebb0a262996e15ee55c51f11f5fd91) more docs - [`f74b075`](https://github.com/langchain-ai/deepagentsjs/commit/f74b0754a7d07157d596eb876843be7ba1c9bbb4) Create orange-scissors-tell.md - [`c0615c0`](https://github.com/langchain-ai/deepagentsjs/commit/c0615c0e572a8b64fd0d9c17ae9728f14d7c9d75) more features ### 📊 Changes **25 files changed** (+8263 additions, -845 deletions) <details> <summary>View changed files</summary> ➕ `.changeset/orange-scissors-tell.md` (+5 -0) ➕ `examples/acp-server/README.md` (+119 -0) ➕ `examples/acp-server/server.ts` (+95 -0) 📝 `examples/package.json` (+1 -0) ➕ `libs/acp/README.md` (+598 -0) ➕ `libs/acp/agent.json` (+14 -0) ➕ `libs/acp/package.json` (+84 -0) ➕ `libs/acp/src/acp-filesystem-backend.test.ts` (+241 -0) ➕ `libs/acp/src/acp-filesystem-backend.ts` (+91 -0) ➕ `libs/acp/src/adapter.test.ts` (+583 -0) ➕ `libs/acp/src/adapter.ts` (+256 -0) ➕ `libs/acp/src/cli.int.test.ts` (+639 -0) ➕ `libs/acp/src/cli.ts` (+332 -0) ➕ `libs/acp/src/index.ts` (+73 -0) ➕ `libs/acp/src/logger.test.ts` (+265 -0) ➕ `libs/acp/src/logger.ts` (+301 -0) ➕ `libs/acp/src/server.int.test.ts` (+378 -0) ➕ `libs/acp/src/server.test.ts` (+1418 -0) ➕ `libs/acp/src/server.ts` (+1392 -0) ➕ `libs/acp/src/types.ts` (+264 -0) _...and 5 more files_ </details> ### 📄 Description This PR introduces the `deepagents-acp` package, enabling DeepAgents to integrate with IDEs like Zed, JetBrains, and other clients that support the [Agent Client Protocol (ACP)](https://agentclientprotocol.com). This brings AI coding assistance directly into development environments through a standardized communication protocol. ## Motivation The Agent Client Protocol is emerging as a standard for how IDEs communicate with AI coding agents. By implementing ACP support, DeepAgents can now: - **Run inside IDEs**: Zed, JetBrains, and other ACP-compatible editors can launch and communicate with DeepAgents - **Leverage native IDE features**: File operations, terminal access, and workspace context are handled through the protocol - **Provide real-time streaming**: Agent responses, tool calls, and task progress stream directly to the IDE ## What's Included ### New Package: `deepagents-acp` A complete ACP server implementation that wraps DeepAgents: | File | Description | |------|-------------| | `server.ts` | Core `DeepAgentsServer` class implementing the ACP protocol | | `cli.ts` | CLI entry point (`npx deepagents-acp`) with full option parsing | | `adapter.ts` | Bidirectional conversion between ACP ContentBlocks and LangChain messages | | `types.ts` | TypeScript types for agent configuration and ACP extensions | | `logger.ts` | Flexible logging utility supporting stderr and file output | | `index.ts` | Public API exports | ### ACP Protocol Implementation **Agent Methods:** - `initialize` - Negotiate protocol version and capabilities - `authenticate` - Pass-through authentication - `session/new` - Create conversation sessions with mode selection - `session/load` - Resume existing sessions - `session/prompt` - Process user prompts with streaming responses - `session/cancel` - Cancel in-progress operations - `session/set_mode` - Switch between agent/plan/ask modes **Session Updates (Streaming):** - `agent_message_chunk` - Stream text responses - `agent_thought_chunk` - Stream agent reasoning - `tool_call` / `tool_call_update` - Track tool execution - `plan` - Send task planning updates ### CLI Features ```bash npx deepagents-acp \ --name my-agent \ --model claude-sonnet-4-5-20250929 \ --skills ./skills \ --memory ./AGENTS.md \ --log-file ./debug.log \ --debug ``` - Supports multiple argument formats for IDE compatibility (`--name value`, `--name=value`) - Environment variable configuration (`ANTHROPIC_API_KEY`, `DEBUG`, `WORKSPACE_ROOT`) - File-based logging for production debugging ### Testing Comprehensive test coverage: | Test File | Type | Tests | |-----------|------|-------| | `server.test.ts` | Unit | Handler methods, configuration, error handling | | `server.int.test.ts` | Integration | Session management, mode switching, cancellation | | `cli.int.test.ts` | CLI Integration | Full protocol flow via spawned process | | `adapter.test.ts` | Unit | Message format conversion | | `logger.test.ts` | Unit | Logging behavior | ### Example Added `examples/acp-server/server.ts` demonstrating programmatic usage with custom configuration. ## Usage ### With Zed Add to `~/.config/zed/settings.json`: ```json { "agent": { "profiles": { "deepagents": { "name": "DeepAgents", "command": "npx", "args": ["deepagents-acp", "--name", "my-agent", "--debug"], "env": { "ANTHROPIC_API_KEY": "sk-ant-..." } } } } } ``` ### Programmatically ```typescript import { DeepAgentsServer, startServer } from "deepagents-acp"; // Quick start await startServer({ agents: { name: "my-agent", skills: ["./skills/"] } }); // Or with full control const server = new DeepAgentsServer({ agents: [ { name: "coder", model: "claude-sonnet-4-5-20250929" }, { name: "reviewer", systemPrompt: "You are a code reviewer..." } ], debug: true, workspaceRoot: process.cwd(), }); await server.start(); ``` ## Architecture ``` ┌─────────────────────────────────────────────────────────────┐ │ IDE (Zed, JetBrains) │ │ ACP Client │ └─────────────────────┬─���─────────────────────────────────────┘ │ stdio (JSON-RPC 2.0 / NDJSON) ▼ ┌─────────────────────────────────────────────────────────────┐ │ deepagents-acp │ │ ┌─────────────────────────────────────────────────────┐ │ │ │ AgentSideConnection (ACP SDK) │ │ │ └─────────────────────┬───────────────────────────────┘ │ │ │ │ │ ┌─────────────────────▼───────────────────────────────┐ │ │ │ Message Adapter │ │ │ │ ACP ContentBlock ⟷ LangChain BaseMessage │ │ │ └─────────────────────┬───────────────────────────────┘ │ │ │ │ │ ┌─────────────────────▼───────────────────────────────┐ │ │ │ DeepAgent (LangGraph) │ │ │ │ Skills • Memory • Tools • Middleware │ │ │ └─────────────────────────────────────────────────────┘ │ └─────────────────────────────────────────────────────────────┘ ``` ## Future Improvements - MCP (Model Context Protocol) server support for tool discovery - HTTP/SSE transport (in addition to stdio) - Session persistence to disk - Multi-agent routing based on task type --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-02-16 06:17:24 -05:00
yindo changed title from [PR #191] feat(server): add ACP support to [PR #191] [MERGED] feat(server): add ACP support 2026-06-05 17:22:21 -04:00
yindo closed this issue 2026-06-05 17:22:21 -04:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/deepagentsjs#195