acpd 1.0.0 copy "acpd: ^1.0.0" to clipboard
acpd: ^1.0.0 copied to clipboard

Dart SDK for the Agent Client Protocol (ACP). Build clients, agents, and proxies that speak the ACP wire protocol.

acpd logo

acpd #

English · 简体中文

The platform-neutral Dart SDK for the Agent Client Protocol (ACP).

Features #

  • Every stable ACP v1 schema type and method.
  • Single and batch JSON-RPC frames with ordered grouped responses.
  • Concurrent bidirectional requests, notifications, extension methods, timeouts, and cooperative cancellation.
  • AgentRole and ClientRole builders with typed handlers and contexts for every stable method, request timeouts, and cooperative cancellation.
  • High-level Session create/load/resume/close lifecycle with streamed updates, live modes, config options, and prompt results.
  • Pure Dart: VM, Flutter, Web, and WASM; no dart:io dependency.

Use acpd_io for stdio/process transports, acpd_http for HTTP/SSE/WebSocket, and acpd_test for test peers.

Usage #

import 'package:acpd/acpd.dart';

Future<PromptTurnResult> promptAgent(
  Transport transport,
  String text,
) async {
  final client = ClientRole().connect(transport);
  try {
    await client.client.initialize(
      const InitializeRequest(
        protocolVersion: ProtocolVersion.v1,
        clientInfo: Implementation(name: 'my-client', version: '1.0.0'),
      ),
    );
    final session = await Session.create(
      client,
      const NewSessionRequest(cwd: '.', mcpServers: []),
    );
    try {
      return await session.sendPrompt(
        <ContentBlock>[TextContentBlock(text: text)],
      );
    } finally {
      session.dispose();
    }
  } finally {
    await client.close();
  }
}

See the package example/ and the full workspace guide.

License #

Apache License 2.0. See LICENSE.

1
likes
160
points
114
downloads

Documentation

Documentation
API reference

Publisher

verified publisherfluttercandies.com

Weekly Downloads

Dart SDK for the Agent Client Protocol (ACP). Build clients, agents, and proxies that speak the ACP wire protocol.

Homepage
Repository (GitHub)
View/report issues

Topics

#acp #agent #protocol #ai #llm

License

Apache-2.0 (license)

Dependencies

meta

More

Packages that depend on acpd