a2a.client.transports package

Submodules

Module contents

A2A Client Transports.

class a2a.client.transports.ClientTransport

Bases: ABC

Abstract base class for a client transport.

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

Requests the agent to cancel a specific task.

abstractmethod async close() None

Closes the transport.

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

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

abstractmethod async delete_task_push_notification_config(request: DeleteTaskPushNotificationConfigRequest, *, context: ClientCallContext | None = None) None

Deletes the push notification configuration for a specific task.

abstractmethod async get_extended_agent_card(request: GetExtendedAgentCardRequest, *, context: ClientCallContext | None = None) AgentCard

Retrieves the Extended AgentCard.

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

Retrieves the current state and history of a specific task.

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

Retrieves the push notification configuration for a specific task.

abstractmethod async list_task_push_notification_configs(request: ListTaskPushNotificationConfigsRequest, *, context: ClientCallContext | None = None) ListTaskPushNotificationConfigsResponse

Lists push notification configurations for a specific task.

abstractmethod async list_tasks(request: ListTasksRequest, *, context: ClientCallContext | None = None) ListTasksResponse

Retrieves tasks for an agent.

abstractmethod async send_message(request: SendMessageRequest, *, context: ClientCallContext | None = None) SendMessageResponse

Sends a non-streaming message request to the agent.

abstractmethod async send_message_streaming(request: SendMessageRequest, *, context: ClientCallContext | None = None) AsyncGenerator[StreamResponse]

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

abstractmethod async subscribe(request: SubscribeToTaskRequest, *, context: ClientCallContext | None = None) AsyncGenerator[StreamResponse]

Reconnects to get task updates.

class a2a.client.transports.GrpcTransport(channel: Channel, agent_card: AgentCard | None)

Bases: ClientTransport

A gRPC transport for the A2A client.

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

Requests the agent to cancel a specific task.

async close() None

Closes the gRPC channel.

classmethod create(card: AgentCard, url: str, config: ClientConfig) GrpcTransport

Creates a gRPC transport for the A2A client.

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

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

async delete_task_push_notification_config(request: DeleteTaskPushNotificationConfigRequest, *, context: ClientCallContext | None = None) None

Deletes the push notification configuration for a specific task.

async get_extended_agent_card(request: GetExtendedAgentCardRequest, *, context: ClientCallContext | None = None) AgentCard

Retrieves the agent’s card.

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

Retrieves the current state and history of a specific task.

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

Retrieves the push notification configuration for a specific task.

async list_task_push_notification_configs(request: ListTaskPushNotificationConfigsRequest, *, context: ClientCallContext | None = None) ListTaskPushNotificationConfigsResponse

Lists push notification configurations for a specific task.

async list_tasks(request: ListTasksRequest, *, context: ClientCallContext | None = None) ListTasksResponse

Retrieves tasks for an agent.

async send_message(request: SendMessageRequest, *, context: ClientCallContext | None = None) SendMessageResponse

Sends a non-streaming message request to the agent.

send_message_streaming(request: SendMessageRequest, *, context: ClientCallContext | None = None) AsyncGenerator[StreamResponse]

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

subscribe(request: SubscribeToTaskRequest, *, context: ClientCallContext | None = None) AsyncGenerator[StreamResponse]

Reconnects to get task updates.

class a2a.client.transports.JsonRpcTransport(httpx_client: AsyncClient, agent_card: AgentCard, url: str)

Bases: ClientTransport

A JSON-RPC transport for the A2A client.

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

Requests the agent to cancel a specific task.

async close() None

Closes the httpx client.

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

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

async delete_task_push_notification_config(request: DeleteTaskPushNotificationConfigRequest, *, context: ClientCallContext | None = None) None

Deletes the push notification configuration for a specific task.

async get_extended_agent_card(request: GetExtendedAgentCardRequest, *, context: ClientCallContext | None = None) AgentCard

Retrieves the agent’s card.

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

Retrieves the current state and history of a specific task.

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

Retrieves the push notification configuration for a specific task.

async list_task_push_notification_configs(request: ListTaskPushNotificationConfigsRequest, *, context: ClientCallContext | None = None) ListTaskPushNotificationConfigsResponse

Lists push notification configurations for a specific task.

async list_tasks(request: ListTasksRequest, *, context: ClientCallContext | None = None) ListTasksResponse

Retrieves tasks for an agent.

async send_message(request: SendMessageRequest, *, context: ClientCallContext | None = None) SendMessageResponse

Sends a non-streaming message request to the agent.

send_message_streaming(request: SendMessageRequest, *, context: ClientCallContext | None = None) AsyncGenerator[StreamResponse]

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

subscribe(request: SubscribeToTaskRequest, *, context: ClientCallContext | None = None) AsyncGenerator[StreamResponse]

Reconnects to get task updates.

class a2a.client.transports.RestTransport(httpx_client: AsyncClient, agent_card: AgentCard, url: str)

Bases: ClientTransport

A REST transport for the A2A client.

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

Requests the agent to cancel a specific task.

async close() None

Closes the httpx client.

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

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

async delete_task_push_notification_config(request: DeleteTaskPushNotificationConfigRequest, *, context: ClientCallContext | None = None) None

Deletes the push notification configuration for a specific task.

async get_extended_agent_card(request: GetExtendedAgentCardRequest, *, context: ClientCallContext | None = None) AgentCard

Retrieves the Extended AgentCard.

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

Retrieves the current state and history of a specific task.

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

Retrieves the push notification configuration for a specific task.

async list_task_push_notification_configs(request: ListTaskPushNotificationConfigsRequest, *, context: ClientCallContext | None = None) ListTaskPushNotificationConfigsResponse

Lists push notification configurations for a specific task.

async list_tasks(request: ListTasksRequest, *, context: ClientCallContext | None = None) ListTasksResponse

Retrieves tasks for an agent.

async send_message(request: SendMessageRequest, *, context: ClientCallContext | None = None) SendMessageResponse

Sends a non-streaming message request to the agent.

send_message_streaming(request: SendMessageRequest, *, context: ClientCallContext | None = None) AsyncGenerator[StreamResponse]

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

subscribe(request: SubscribeToTaskRequest, *, context: ClientCallContext | None = None) AsyncGenerator[StreamResponse]

Reconnects to get task updates.