Module: Keycardai::A2A
- Defined in:
- lib/keycardai/a2a.rb,
lib/keycardai/a2a/wire.rb,
lib/keycardai/a2a/errors.rb,
lib/keycardai/a2a/version.rb,
lib/keycardai/a2a/delegation_client.rb,
lib/keycardai/a2a/service_discovery.rb
Overview
The A2A delegation client and its result type.
Defined Under Namespace
Classes: DelegationClient, DiscoveryError, InvocationError, Result, ServiceDiscovery, Wire
Constant Summary collapse
- AGENT_CARD_PATH =
Well-known path of an agent's card, relative to its base URL.
"/.well-known/agent-card.json"- JSONRPC_PATH =
JSON-RPC invocation path, relative to an agent's base URL.
"/a2a/jsonrpc"- PROTOCOL_VERSION =
A2A protocol version spoken by default: the 1.0 generation, which is what keycardai-a2a (Python) and @keycardai/a2a (TypeScript) serve.
"1.0"- LEGACY_PROTOCOL_VERSION =
The 0.3 generation, for agents not yet on 1.0. Pass it as DelegationClient's protocol_version: to send 0.3-shaped requests.
"0.3"- MESSAGE_SEND_METHOD =
JSON-RPC method that delivers a message to a 1.0 agent.
"SendMessage"- LEGACY_MESSAGE_SEND_METHOD =
JSON-RPC method that delivers a message to a 0.3 agent.
"message/send"- PROTOCOL_VERSION_HEADER =
Header carrying the protocol version on a 1.0 request.
"A2A-Version"- LEGACY_PROTOCOL_VERSION_HEADER =
Header carrying the protocol version on a 0.3 request.
"X-A2A-Protocol-Version"- ROLE_USER =
Message roles as the 1.0 protocol names them (0.3 used "user"/"agent").
"ROLE_USER"- ROLE_AGENT =
"ROLE_AGENT"- VERSION =
"0.2.0"
Class Method Summary collapse
-
.text_message(text) ⇒ Hash
Build A2A 1.0 SendMessage params carrying one text part, the common case for driving a downstream agent.
Class Method Details
.text_message(text) ⇒ Hash
Build A2A 1.0 SendMessage params carrying one text part, the common case for driving a downstream agent. A client configured for 0.3 translates the role and part shape on the way out.
108 109 110 111 112 113 114 115 116 |
# File 'lib/keycardai/a2a/delegation_client.rb', line 108 def self.(text) { "message" => { "role" => ROLE_USER, "parts" => [{ "text" => text }], "messageId" => SecureRandom.uuid } } end |