Skip to content

Conversation

@ishymko
Copy link
Member

@ishymko ishymko commented Nov 7, 2025

Description

Currently A2AClient defined in client.ts uses JSON-RPC types in its interface, i.e. sendMessage uses SendMessageResponse which contains JSON-RPC fields like id and jsonrpc version. It was also the case for Python SDK which required introducing a new client.py keeping the old one as legacy.py for backward compatibility (see #348).

As a first step of introducing a transport-agnostic client, extract JSON-RPC specific logic into a transport abstraction and switch existing A2AClient to it in a backward compatible way to take advantage of existing tests.

Note: new types are not exported from index.ts, this will be done once new client is ready.

Changes

  1. Define A2ATransport abstraction without using JSON-RPC types.
  2. Implement JsonRpcTransport from existing A2AClient.
  3. Use new JsonRpcTransport from A2AClient - new transports are not going to be added into this client as it uses JSON-RPC types. This is done in a backward compatible way, existing behavior is preserved: returning JSON-RPC errors as objects, populating JSON-RPC specific fields.
  4. Define shared transport-agnostic errors for A2A specific errors defined in the spec.

Re #137, #142

@ishymko ishymko force-pushed the ishymko/client-transport branch from c156b2f to ede8673 Compare November 7, 2025 12:37
@ishymko ishymko marked this pull request as ready for review November 7, 2025 12:38
@ishymko ishymko requested a review from yarolegovich November 7, 2025 12:38
@ishymko ishymko requested a review from guglielmo-san November 7, 2025 13:30
@ishymko ishymko force-pushed the ishymko/client-transport branch from a9487aa to 4317636 Compare November 12, 2025 11:41
@ishymko ishymko requested a review from yarolegovich November 12, 2025 11:44
@ishymko ishymko requested a review from swapydapy November 12, 2025 16:16
@ishymko ishymko requested a review from swapydapy November 13, 2025 10:36
@herczyn herczyn self-requested a review November 18, 2025 13:31
Copy link
Member

@herczyn herczyn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@ishymko ishymko merged commit dc9f7dc into main Nov 19, 2025
5 checks passed
@ishymko ishymko deleted the ishymko/client-transport branch November 19, 2025 09:00
ishymko added a commit that referenced this pull request Nov 27, 2025
# Description

As a next step after #169, define a transport agnostic client.

# Changes

## Main
- Define `Client` built around core types, not JSON-RPC wrappers.
- Define `ClientFactory` to dynamically select transport among available
based on agent card and factory level preferences.

## Misc
- Rename `A2ATransport` to `Transport` (this type is not yet exported
via `index.ts`).
- Add `AbortSignal` to `Transport` and new client for cancellation.
- Add basic E2E test for `sendMessage` and `sendMessageStream` using
server SDK wired up with real expressjs app and invoked via newly
created client.
- Fix `getTaskPushNotificationConfig` types in transport.

# TODOs
- Client interceptors.
- Extensions support.

Re #137, #142

Release-As: 0.3.6
@ishymko ishymko mentioned this pull request Dec 10, 2025
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants