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
Installation
Add to pubspec.yaml
Add the
acp_dart package to your project’s pubspec.yaml file:pubspec.yaml
The SDK follows semantic versioning. Use
^0.3.0 to automatically receive compatible updates.Install dependencies
Run the following command to install the package and its dependencies:For Flutter projects, use:
Verify Installation
Create a simple test file to verify the installation:test_acp.dart
What’s Included
When you installacp_dart, you get:
Core Connections
Core Connections
AgentSideConnection- For building agentsClientSideConnection- For building clientsConnection- Low-level RPC connection management
Interfaces
Interfaces
Agent- Agent-side request handlersClient- Client-side request handlersProtocolCancellationHandler- Handle cancellation notifications
Schema Types
Schema Types
- Request/Response types for all ACP methods
InitializeRequest,InitializeResponseNewSessionRequest,NewSessionResponsePromptRequest,PromptResponse- Session updates:
SessionNotification,ToolCallSessionUpdate, etc. - Content blocks:
TextContentBlock,ImageContentBlock, etc. - And many more…
RPC Unions
RPC Unions
- Type-safe unions for exhaustive handling
RequestPermissionOutcome(SelectedOutcome, CancelledOutcome)- Session update variants
- Content block variants
- Tool call content variants
Utilities
Utilities
ndJsonStream- NDJSON stream creationTerminalHandle- Terminal operation managementRequestError- Error handling utilitiesAcpStream- Stream abstraction
Dependencies
The SDK has minimal dependencies:These dependencies are automatically installed when you run
dart pub get.Development Dependencies
For SDK development or if you’re contributing: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
Dart version conflict
Dart version conflict
If you see an error about SDK version compatibility:Solution: Upgrade your Dart SDK:
Package not found
Package not found
If
dart pub get fails to find the package:Solution: Ensure you have internet access and pub.dev is reachable:Import errors
Import errors
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: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