agent2agentSourceA2AClient

class Client

Faraday-based A2A protocol client.

Supports both protocol bindings: JSON-RPC 2.0 and HTTP+JSON/REST. Uses the async-http-faraday adapter for fiber-based non-blocking I/O and supports SSE streaming for long-lived connections.

Request params are validated against the operation's request schema before sending. Responses are returned as Schema::Definition objects.

JSON-RPC (default)

client = A2A::Client.new("http://localhost:9292")

REST

client = A2A::Client.new("http://localhost:9292", binding: :rest)

Nested

Definitions

def agent_card

GET /.well-known/agent-card.json

Returns an A2A::Schema["Agent Card"] instance.

Implementation

def agent_card
  response = @conn.get("/.well-known/agent-card.json")
  parsed = response.body
  A2A::Schema["Agent Card"].new(parsed)
end