Skip to main content
The ACP TypeScript SDK allows you to extend the protocol with custom methods and notifications that aren’t part of the core specification. This is useful for:
  • Adding proprietary features to your agent or client
  • Implementing experimental capabilities
  • Integrating with custom systems

Overview

Both sides of the connection support extension methods:
  • Agent side: Implement extMethod and extNotification in your Agent implementation
  • Client side: Implement extMethod and extNotification in your Client implementation
Extension methods and notifications work just like standard protocol methods, using the same JSON-RPC 2.0 message format.

Agent Extension Methods

Agents can handle custom requests from clients by implementing the optional extMethod and extNotification methods:

Receiving Extension Methods

Sending Extension Methods (Agent to Client)

Agents can call custom methods on the client using AgentSideConnection:

Client Extension Methods

Clients can handle custom requests from agents similarly:

Receiving Extension Methods

Sending Extension Methods (Client to Agent)

Naming Conventions

To avoid conflicts with future protocol additions and other implementations, follow these naming conventions:

Use Reverse Domain Names

Prefix your extension methods with a reverse domain name:

Use Descriptive Names

Method names should clearly indicate their purpose:

Type Safety with Extensions

For better type safety, define interfaces for your extension methods:

Complete Example

Here’s a complete example showing bidirectional extension methods:

Best Practices

  1. Always use namespaced method names to avoid conflicts
  2. Document your extensions clearly for users of your implementation
  3. Handle unknown methods gracefully by throwing RequestError.methodNotFound
  4. Version your extension methods if you expect them to change
  5. Consider backward compatibility when modifying extension method behavior