Skip to main content

Build AI-Powered Applications with ACP

The official Dart implementation of the Agent Client Protocol (ACP) — a standardized communication protocol between code editors and AI-powered coding agents. Build robust agents and clients with full type safety.

Key Features

Type-Safe Communication

Full Dart type annotations with null safety and sealed union types for exhaustive message handling

Complete Protocol Support

Comprehensive implementation of ACP stable features with support for unstable and extension methods

Stream-Based Architecture

NDJSON-based communication over stdio with built-in error handling and automatic JSON-RPC error mapping

Terminal & File Operations

Built-in support for terminal management, file system operations, and session lifecycle control

Quick Example

Build an agent in minutes with the ACP Dart SDK:
agent.dart
import 'dart:io';
import 'package:acp_dart/acp_dart.dart';

class MyAgent implements Agent {
  final AgentSideConnection _connection;

  MyAgent(this._connection);

  @override
  Future<InitializeResponse> initialize(InitializeRequest params) async {
    return InitializeResponse(
      protocolVersion: '0.1.0',
      capabilities: AgentCapabilities(
        loadSession: false,
        auth: [],
      ),
    );
  }

  @override
  Future<NewSessionResponse> newSession(NewSessionRequest params) async {
    return NewSessionResponse(
      sessionId: 'session-123',
      availableModes: [],
    );
  }

  // Implement other required methods...
}

void main() {
  final stream = ndJsonStream(stdin, stdout);
  final connection = AgentSideConnection((conn) => MyAgent(conn), stream);
}

Getting Started

Installation

Add the SDK to your Dart project with pub

Quickstart

Build your first agent or client in 5 minutes

Core Concepts

Learn about agents, clients, and the ACP protocol

Protocol Support

The SDK provides comprehensive support for the Agent Client Protocol:

Agent Methods

initialize, session/new, session/load, session/prompt, session/cancel, and more

Client Methods

fs/read_text_file, fs/write_text_file, terminal/create, session/request_permission

Session Updates

Real-time streaming of message chunks, tool calls, plans, and execution updates

Error Handling

JSON-RPC error mapping with typed error responses and cancellation support

Resources

API Reference

Complete API documentation for all types and methods

Examples

Working examples of agents and clients

Protocol Spec

Official ACP protocol documentation

Build docs developers (and LLMs) love