a2a.client.transports package

Submodules

a2a.client.transports.base module

class a2a.client.transports.base.ClientTransport

Bases: ABC

Abstract base class for a client transport.

abstractmethod async cancel_task(request: TaskIdParams, *, context: ClientCallContext | None = None) Task

Requests the agent to cancel a specific task.

abstractmethod async close() None

Closes the transport.

abstractmethod async get_card(*, context: ClientCallContext | None = None) AgentCard

Retrieves the AgentCard.

abstractmethod async get_task(request: TaskQueryParams, *, context: ClientCallContext | None = None) Task

Retrieves the current state and history of a specific task.

abstractmethod async get_task_callback(request: GetTaskPushNotificationConfigParams, *, context: ClientCallContext | None = None) TaskPushNotificationConfig

Retrieves the push notification configuration for a specific task.

abstractmethod async resubscribe(request: TaskIdParams, *, context: ClientCallContext | None = None) AsyncGenerator[Task | Message | TaskStatusUpdateEvent | TaskArtifactUpdateEvent]

Reconnects to get task updates.

abstractmethod async send_message(request: MessageSendParams, *, context: ClientCallContext | None = None) Task | Message

Sends a non-streaming message request to the agent.

abstractmethod async send_message_streaming(request: MessageSendParams, *, context: ClientCallContext | None = None) AsyncGenerator[Message | Task | TaskStatusUpdateEvent | TaskArtifactUpdateEvent]

Sends a streaming message request to the agent and yields responses as they arrive.

abstractmethod async set_task_callback(request: TaskPushNotificationConfig, *, context: ClientCallContext | None = None) TaskPushNotificationConfig

Sets or updates the push notification configuration for a specific task.

a2a.client.transports.grpc module

a2a.client.transports.jsonrpc module

class a2a.client.transports.jsonrpc.JsonRpcTransport(httpx_client: AsyncClient, agent_card: AgentCard | None = None, url: str | None = None, interceptors: list[ClientCallInterceptor] | None = None)

Bases: ClientTransport

A JSON-RPC transport for the A2A client.

async cancel_task(request: TaskIdParams, *, context: ClientCallContext | None = None) Task

Requests the agent to cancel a specific task.

async close() None

Closes the httpx client.

async get_card(*, context: ClientCallContext | None = None) AgentCard

Retrieves the agent’s card.

async get_task(request: TaskQueryParams, *, context: ClientCallContext | None = None) Task

Retrieves the current state and history of a specific task.

async get_task_callback(request: GetTaskPushNotificationConfigParams, *, context: ClientCallContext | None = None) TaskPushNotificationConfig

Retrieves the push notification configuration for a specific task.

resubscribe(request: TaskIdParams, *, context: ClientCallContext | None = None) AsyncGenerator[Task | Message | TaskStatusUpdateEvent | TaskArtifactUpdateEvent]

Reconnects to get task updates.

async send_message(request: MessageSendParams, *, context: ClientCallContext | None = None) Task | Message

Sends a non-streaming message request to the agent.

send_message_streaming(request: MessageSendParams, *, context: ClientCallContext | None = None) AsyncGenerator[Message | Task | TaskStatusUpdateEvent | TaskArtifactUpdateEvent]

Sends a streaming message request to the agent and yields responses as they arrive.

async set_task_callback(request: TaskPushNotificationConfig, *, context: ClientCallContext | None = None) TaskPushNotificationConfig

Sets or updates the push notification configuration for a specific task.

a2a.client.transports.rest module

class a2a.client.transports.rest.RestTransport(httpx_client: AsyncClient, agent_card: AgentCard | None = None, url: str | None = None, interceptors: list[ClientCallInterceptor] | None = None)

Bases: ClientTransport

A REST transport for the A2A client.

async cancel_task(request: TaskIdParams, *, context: ClientCallContext | None = None) Task

Requests the agent to cancel a specific task.

async close() None

Closes the httpx client.

async get_card(*, context: ClientCallContext | None = None) AgentCard

Retrieves the agent’s card.

async get_task(request: TaskQueryParams, *, context: ClientCallContext | None = None) Task

Retrieves the current state and history of a specific task.

async get_task_callback(request: GetTaskPushNotificationConfigParams, *, context: ClientCallContext | None = None) TaskPushNotificationConfig

Retrieves the push notification configuration for a specific task.

resubscribe(request: TaskIdParams, *, context: ClientCallContext | None = None) AsyncGenerator[Task | TaskStatusUpdateEvent | TaskArtifactUpdateEvent | Message]

Reconnects to get task updates.

async send_message(request: MessageSendParams, *, context: ClientCallContext | None = None) Task | Message

Sends a non-streaming message request to the agent.

send_message_streaming(request: MessageSendParams, *, context: ClientCallContext | None = None) AsyncGenerator[Task | TaskStatusUpdateEvent | TaskArtifactUpdateEvent | Message]

Sends a streaming message request to the agent and yields responses as they arrive.

async set_task_callback(request: TaskPushNotificationConfig, *, context: ClientCallContext | None = None) TaskPushNotificationConfig

Sets or updates the push notification configuration for a specific task.

Module contents

A2A Client Transports.

class a2a.client.transports.ClientTransport

Bases: ABC

Abstract base class for a client transport.

abstractmethod async cancel_task(request: TaskIdParams, *, context: ClientCallContext | None = None) Task

Requests the agent to cancel a specific task.

abstractmethod async close() None

Closes the transport.

abstractmethod async get_card(*, context: ClientCallContext | None = None) AgentCard

Retrieves the AgentCard.

abstractmethod async get_task(request: TaskQueryParams, *, context: ClientCallContext | None = None) Task

Retrieves the current state and history of a specific task.

abstractmethod async get_task_callback(request: GetTaskPushNotificationConfigParams, *, context: ClientCallContext | None = None) TaskPushNotificationConfig

Retrieves the push notification configuration for a specific task.

abstractmethod async resubscribe(request: TaskIdParams, *, context: ClientCallContext | None = None) AsyncGenerator[Task | Message | TaskStatusUpdateEvent | TaskArtifactUpdateEvent]

Reconnects to get task updates.

abstractmethod async send_message(request: MessageSendParams, *, context: ClientCallContext | None = None) Task | Message

Sends a non-streaming message request to the agent.

abstractmethod async send_message_streaming(request: MessageSendParams, *, context: ClientCallContext | None = None) AsyncGenerator[Message | Task | TaskStatusUpdateEvent | TaskArtifactUpdateEvent]

Sends a streaming message request to the agent and yields responses as they arrive.

abstractmethod async set_task_callback(request: TaskPushNotificationConfig, *, context: ClientCallContext | None = None) TaskPushNotificationConfig

Sets or updates the push notification configuration for a specific task.

class a2a.client.transports.JsonRpcTransport(httpx_client: AsyncClient, agent_card: AgentCard | None = None, url: str | None = None, interceptors: list[ClientCallInterceptor] | None = None)

Bases: ClientTransport

A JSON-RPC transport for the A2A client.

async cancel_task(request: TaskIdParams, *, context: ClientCallContext | None = None) Task

Requests the agent to cancel a specific task.

async close() None

Closes the httpx client.

async get_card(*, context: ClientCallContext | None = None) AgentCard

Retrieves the agent’s card.

async get_task(request: TaskQueryParams, *, context: ClientCallContext | None = None) Task

Retrieves the current state and history of a specific task.

async get_task_callback(request: GetTaskPushNotificationConfigParams, *, context: ClientCallContext | None = None) TaskPushNotificationConfig

Retrieves the push notification configuration for a specific task.

resubscribe(request: TaskIdParams, *, context: ClientCallContext | None = None) AsyncGenerator[Task | Message | TaskStatusUpdateEvent | TaskArtifactUpdateEvent]

Reconnects to get task updates.

async send_message(request: MessageSendParams, *, context: ClientCallContext | None = None) Task | Message

Sends a non-streaming message request to the agent.

send_message_streaming(request: MessageSendParams, *, context: ClientCallContext | None = None) AsyncGenerator[Message | Task | TaskStatusUpdateEvent | TaskArtifactUpdateEvent]

Sends a streaming message request to the agent and yields responses as they arrive.

async set_task_callback(request: TaskPushNotificationConfig, *, context: ClientCallContext | None = None) TaskPushNotificationConfig

Sets or updates the push notification configuration for a specific task.

class a2a.client.transports.RestTransport(httpx_client: AsyncClient, agent_card: AgentCard | None = None, url: str | None = None, interceptors: list[ClientCallInterceptor] | None = None)

Bases: ClientTransport

A REST transport for the A2A client.

async cancel_task(request: TaskIdParams, *, context: ClientCallContext | None = None) Task

Requests the agent to cancel a specific task.

async close() None

Closes the httpx client.

async get_card(*, context: ClientCallContext | None = None) AgentCard

Retrieves the agent’s card.

async get_task(request: TaskQueryParams, *, context: ClientCallContext | None = None) Task

Retrieves the current state and history of a specific task.

async get_task_callback(request: GetTaskPushNotificationConfigParams, *, context: ClientCallContext | None = None) TaskPushNotificationConfig

Retrieves the push notification configuration for a specific task.

resubscribe(request: TaskIdParams, *, context: ClientCallContext | None = None) AsyncGenerator[Task | TaskStatusUpdateEvent | TaskArtifactUpdateEvent | Message]

Reconnects to get task updates.

async send_message(request: MessageSendParams, *, context: ClientCallContext | None = None) Task | Message

Sends a non-streaming message request to the agent.

send_message_streaming(request: MessageSendParams, *, context: ClientCallContext | None = None) AsyncGenerator[Task | TaskStatusUpdateEvent | TaskArtifactUpdateEvent | Message]

Sends a streaming message request to the agent and yields responses as they arrive.

async set_task_callback(request: TaskPushNotificationConfig, *, context: ClientCallContext | None = None) TaskPushNotificationConfig

Sets or updates the push notification configuration for a specific task.