dotacp.protocol 0.1.0-alpha.1

This is a prerelease version of dotacp.protocol.
There is a newer version of this package available.
See the version list below for details.
dotnet add package dotacp.protocol --version 0.1.0-alpha.1
                    
NuGet\Install-Package dotacp.protocol -Version 0.1.0-alpha.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="dotacp.protocol" Version="0.1.0-alpha.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="dotacp.protocol" Version="0.1.0-alpha.1" />
                    
Directory.Packages.props
<PackageReference Include="dotacp.protocol" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add dotacp.protocol --version 0.1.0-alpha.1
                    
#r "nuget: dotacp.protocol, 0.1.0-alpha.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package dotacp.protocol@0.1.0-alpha.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=dotacp.protocol&version=0.1.0-alpha.1&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=dotacp.protocol&version=0.1.0-alpha.1&prerelease
                    
Install as a Cake Tool

dotacp - Agent Client Protocol .NET SDK

GitHub License Build Status Unit Testing codecov NuGet

A comprehensive .NET implementation of the Agent Client Protocol (ACP), enabling seamless communication between code editors/IDEs and AI coding agents.

What is ACP?

The Agent Client Protocol is a standardized protocol for communication between code editors/IDEs and AI coding agents, similar to how the Language Server Protocol (LSP) standardized language server integration.

ACP solves the interoperability problem in AI-assisted coding:

  • For Agents: Implement once, work with any compatible editor
  • For Editors: Support any ACP-compatible agent without custom integrations
  • For Developers: Choose the best combination of tools for your workflow

Key Benefits

  • πŸ”Œ Protocol Standardization: No more custom integrations per agent-editor pair
  • πŸ—οΈ Decoupled Architecture: Agents and editors innovate independently
  • 🌐 Local & Remote Support: Works with local subprocess agents and cloud-hosted services
  • πŸ“¦ MCP Integration: Compatible with Model Context Protocol (MCP) for enhanced tool capabilities

Project Structure

This repository contains a complete .NET SDK implementation with the following components:

Core Projects

  • protocol/ - Protocol definitions and data models

    • Auto-generated schema from the ACP specification (v0.10.8)
    • Type-safe representations of all protocol messages
    • Support for JSON-RPC communication patterns
    • Contains type aliases, enums, request/response models, and content types
  • client/ - Client library for implementing ACP clients

    • IAcpClient.cs - Core client interface definitions
    • Connection.cs - Connection management and lifecycle
    • ClientRpcTarget.cs - RPC message routing
    • Handles authentication, session management, and bidirectional communication
  • clientcli/ - Example CLI client implementation

    • Demonstrates how to use the SDK to build an ACP client
    • Reference implementation for developers
  • unittest/ - Comprehensive test suite

    • Protocol conformance tests
    • Integration tests
    • Examples and usage patterns
  • generator/ - Code generation utilities

    • Maintains type-safe protocol models
    • Supports schema updates and evolution

Quick Start

Prerequisites

  • .NET Framework: 4.7.2 or higher
  • .NET Standard: 2.0 compatible
  • Dependencies: Newtonsoft.Json for JSON serialization

Installation

Add the NuGet package to your project:

dotnet add package dotacp.protocol
dotnet add package dotacp.client

Or manually reference the project:

<ItemGroup>
    <ProjectReference Include="path/to/client/client.csproj" />
    <ProjectReference Include="path/to/protocol/protocol.csproj" />
</ItemGroup>

Basic Usage

1. Connect to Agent
// start the agent process
var process = ...

// connect
var connection = Connection.ConnectToAgent(
    client,
    process.StandardInput.BaseStream,
    process.StandardOutput.BaseStream);
2. Initialize a Session
using dotacp.protocol;
using dotacp.client;

// Create a new session
var request = new NewSessionRequest
{
    Cwd = "/path/to/project",
    McpServers = new McpServer[] { }
};

var response = await client.NewSessionAsync(request);
var sessionId = response.SessionId;
3. Send a User Prompt
var promptRequest = new PromptRequest
{
    SessionId = sessionId,
    Prompt = new ContentBlock[]
    {
        new TextContent 
        { 
            Text = "Help me refactor this function to use async/await" 
        }
    }
};

await client.PromptAsync(promptRequest);
3. Handle Session Updates
// Session notify through IAcpClient.SessionUpdateAsync
{
    switch (notification.Update)
    {
        case Plan plan:
            Console.WriteLine($"Agent plan: {plan.Entries.Length} tasks");
            break;

        case ToolCall toolCall:
            Console.WriteLine($"Tool executing: {toolCall.Title}");
            Console.WriteLine($"Status: {toolCall.Status}");
            break;

        case SessionUpdateAgentMessageChunk chunk:
            Console.WriteLine($"Agent: {chunk.Content.Text}");
            break;

        // handle other update notification
    }
};
4. Cancel Operations
var cancelNotification = new CancelNotification
{
    SessionId = sessionId
};

await connection.CancelAsync(cancelNotification);

Architecture

Connection Lifecycle

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                    Client Application                   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                           β”‚
                    β”Œβ”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”
                    β”‚  IAcpClient β”‚
                    β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜
                           β”‚
        β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
        β”‚                  β”‚                  β”‚
   β”Œβ”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”      β”Œβ”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”      β”Œβ”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”
   β”‚Session  β”‚      β”‚Connection β”‚      β”‚   RPC   β”‚
   β”‚Mgmt     β”‚      β”‚Management β”‚      β”‚ Routing β”‚
   β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”˜      β””β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜      β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”˜
        β”‚                  β”‚                  β”‚
        β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                           β”‚
                β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                β”‚  JSON-RPC Transport  β”‚
                β”‚(stdio/HTTP/WebSocket)β”‚
                β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                           β”‚
                    β”Œβ”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”
                    β”‚  ACP Agent  β”‚
                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Message Flow

  1. Initialization: Client sends initialize request, agent responds with capabilities
  2. Session Creation: Client creates session with session/new
  3. User Input: Client sends prompts via session/prompt
  4. Real-time Updates: Agent streams session/update notifications
  5. Tool Execution: Agent executes tools, client may request permissions
  6. Session Termination: Client cancels or closes session

Examples

Example 1: Interactive Chat Client

See clientcli/Client.cs for a complete example of building an interactive ACP client.

Contributing

Contributions are welcome! Please ensure:

  • Code follows the existing style conventions
  • All tests pass: dotnet test
  • Changes maintain protocol compliance
  • XML documentation is updated

Development

Build from Source

# Clone the repository
git clone https://github.com/timxx/dotacp.git
cd dotacp

# Build the solution
dotnet build

# Run tests
dotnet test

# Build release package
dotnet pack -c Release

Schema Generation

The protocol types are generated from the official ACP schema. To update:

# Generate from current schema
pwsh ./scripts/gen-schema.ps1

# Update to latest schema
pwsh ./scripts/gen-schema.ps1 -Version main -Force

Local CI-Style Build

For testing the CI build locally (with modern target frameworks), use the helper script:

# Build and test with modern TFMs enabled (default)
pwsh ./scripts/build-ci.ps1

# Debug build variant
pwsh ./scripts/build-ci.ps1 -Configuration Debug

# Disable modern TFMs (local dev mode)
pwsh ./scripts/build-ci.ps1 -EnableModernTargetFrameworks:$false

Target Frameworks

  • Local/VS2019 default: netstandard2.0;net472 (unchanged, no new SDK required)
  • CI builds: Adds net10.0;net9.0;net8.0 for client and protocol only
  • Activation: Set /p:EnableCiTargetFrameworks=true in MSBuild or use the script above

References

License

This project is licensed under the MIT License. See LICENSE file for details.

Support


Made with ❀️ for the AI-assisted coding community

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 is compatible.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on dotacp.protocol:

Package Downloads
dotacp.client

This package provides the tools needed to integrate Agent Client Protocol (ACP) agent support into editors, IDEs, and other client applications.

dotacp.agent

This package provides the tools needed to build Agent Client Protocol (ACP) agent implementations in .NET.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2026.5.10 187 5/10/2026
2026.3.18 181 3/18/2026
2026.3.12-beta.1 70 3/12/2026
0.1.0-beta.2 65 3/9/2026
0.1.0-beta.1 66 3/5/2026
0.1.0-alpha.4 63 3/3/2026
0.1.0-alpha.3 67 3/2/2026
0.1.0-alpha.2 66 3/2/2026
0.1.0-alpha.1 65 3/1/2026