A2AClient

interface A2AClient(source)

Client for interacting with an A2A (Agent-to-Agent) server.

This client provides methods for all operations supported by the A2A protocol, including sending tasks, getting tasks, canceling tasks, and managing push notifications. It also supports streaming operations for real-time task updates.

The A2A protocol enables communication between AI agents, allowing them to work together on complex tasks. This client implementation handles the HTTP communication details and data serialization/deserialization required by the protocol.

Inheritors

Properties

Link copied to clipboard
abstract val httpClient: HttpClient

Gets the underlying HTTP client.

Functions

Link copied to clipboard
abstract suspend fun cancelTask(request: CancelTaskRequest): CancelTaskResponse

Cancels a task on the server using a pre-constructed request object.

abstract suspend fun cancelTask(id: TaskId): CancelTaskResponse

Cancels a task on the server.

Link copied to clipboard
abstract fun close()

Closes the client and releases resources.

Link copied to clipboard
abstract suspend fun getAgentCard(): AgentCard

Gets the agent card from the server.

Link copied to clipboard
abstract suspend fun getTask(request: GetTaskRequest): GetTaskResponse

Gets a task from the server using a pre-constructed request object.

abstract suspend fun getTask(id: TaskId, historyLength: Int? = null): GetTaskResponse

Gets a task from the server.

Link copied to clipboard

Gets the push notification configuration for a task using a pre-constructed request object.

Gets the push notification configuration for a task.

Link copied to clipboard

Resubscribes to streaming updates for a task.

Link copied to clipboard
abstract suspend fun sendMessage(params: MessageSendParams): SendMessageResponse

Sends a message to an agent using the A2A protocol's message/send method.

abstract suspend fun sendMessage(request: SendMessageRequest): SendMessageResponse

Sends a message to an agent using a pre-constructed request object.

Link copied to clipboard

Sends a message to an agent with streaming updates using the A2A protocol's message/stream method.

Sends a message to an agent with streaming updates using a pre-constructed request object.

Link copied to clipboard

Sets push notification configuration for a task using a pre-constructed request object.

Sets push notification configuration for a task.