Skip to main content

Requirements

Before installing the ACP Dart SDK, ensure you have:

Dart SDK

Dart SDK version 3.9.2 or higher

Package Manager

Access to pub.dev for package installation
Check your Dart version by running dart --version in your terminal.

Installation

1

Add to pubspec.yaml

Add the acp_dart package to your project’s pubspec.yaml file:
pubspec.yaml
dependencies:
  acp_dart: ^0.3.0
The SDK follows semantic versioning. Use ^0.3.0 to automatically receive compatible updates.
2

Install dependencies

Run the following command to install the package and its dependencies:
dart pub get
For Flutter projects, use:
flutter pub get
3

Import the library

Import the SDK in your Dart files:
import 'package:acp_dart/acp_dart.dart';
This gives you access to all core types, connections, and utilities.

Verify Installation

Create a simple test file to verify the installation:
test_acp.dart
import 'package:acp_dart/acp_dart.dart';

void main() {
  // Create a simple initialize request
  final request = InitializeRequest(
    protocolVersion: 1,
    clientCapabilities: ClientCapabilities(
      fs: FileSystemCapability(
        readTextFile: true,
        writeTextFile: true,
      ),
      terminal: true,
    ),
  );

  print('ACP SDK successfully installed!');
  print('Protocol version: ${request.protocolVersion}');
}
Run it:
dart run test_acp.dart
You should see:
ACP SDK successfully installed!
Protocol version: 1

What’s Included

When you install acp_dart, you get:
  • AgentSideConnection - For building agents
  • ClientSideConnection - For building clients
  • Connection - Low-level RPC connection management
  • Agent - Agent-side request handlers
  • Client - Client-side request handlers
  • ProtocolCancellationHandler - Handle cancellation notifications
  • Request/Response types for all ACP methods
  • InitializeRequest, InitializeResponse
  • NewSessionRequest, NewSessionResponse
  • PromptRequest, PromptResponse
  • Session updates: SessionNotification, ToolCallSessionUpdate, etc.
  • Content blocks: TextContentBlock, ImageContentBlock, etc.
  • And many more…
  • Type-safe unions for exhaustive handling
  • RequestPermissionOutcome (SelectedOutcome, CancelledOutcome)
  • Session update variants
  • Content block variants
  • Tool call content variants
  • ndJsonStream - NDJSON stream creation
  • TerminalHandle - Terminal operation management
  • RequestError - Error handling utilities
  • AcpStream - Stream abstraction

Dependencies

The SDK has minimal dependencies:
dependencies:
  collection: ^1.18.0  # Collection utilities
  path: ^1.9.0         # Path manipulation
  json_annotation: ^4.9.0  # JSON serialization annotations
These dependencies are automatically installed when you run dart pub get.

Development Dependencies

For SDK development or if you’re contributing:
dev_dependencies:
  build_runner: ^2.8.0           # Code generation
  json_serializable: ^6.11.1     # JSON serialization
  lints: ^6.0.0                  # Linting rules
  test: ^1.25.6                  # Testing framework

IDE Setup

VS Code

Install the Dart extension for:
  • Syntax highlighting
  • Code completion
  • Type checking
  • Debugging support

IntelliJ IDEA / Android Studio

Install the Dart plugin for full IDE support.

Troubleshooting

If you see an error about SDK version compatibility:
The current Dart SDK version is X.X.X.
Because acp_dart requires SDK version ^3.9.2...
Solution: Upgrade your Dart SDK:
# Using Homebrew (macOS)
brew upgrade dart

# Or download from dart.dev
# https://dart.dev/get-dart
If dart pub get fails to find the package:Solution: Ensure you have internet access and pub.dev is reachable:
# Test pub.dev connectivity
dart pub get --verbose
If you see “Target of URI doesn’t exist” errors:Solution: Make sure you’ve run dart pub get and the package is in your pubspec.yaml:
dart pub get
# Then restart your IDE/editor
If you encounter issues not listed here, please check the GitHub repository for known issues or create a new issue.

Next Steps

Now that you have the SDK installed, you’re ready to build your first agent or client:

Quickstart Guide

Build a working agent in minutes

API Reference

Explore the complete API documentation

Build docs developers (and LLMs) love