Class: A2A::Client
- Inherits:
-
Object
- Object
- A2A::Client
- Defined in:
- lib/a2a/client.rb
Overview
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)
Instance Method Summary collapse
-
#agent_card ⇒ Object
GET /.well-known/agent-card.json.
-
#initialize(url, binding: :json_rpc, &block) ⇒ Client
constructor
A new instance of Client.
Constructor Details
#initialize(url, binding: :json_rpc, &block) ⇒ Client
Returns a new instance of Client.
26 27 28 29 30 |
# File 'lib/a2a/client.rb', line 26 def initialize(url, binding: :json_rpc, &block) @url = url.chomp("/") @binding = binding @conn = build_connection(&block) end |