Class: LLM::A2A::Card
- Inherits:
-
Object
- Object
- LLM::A2A::Card
- Defined in:
- lib/llm/a2a/card.rb,
lib/llm/a2a/card/skill.rb,
lib/llm/a2a/card/provider.rb,
lib/llm/a2a/card/interface.rb,
lib/llm/a2a/card/capabilities.rb
Overview
Represents an A2A Agent Card — a self-describing manifest for an agent that provides metadata including the agent's identity, capabilities, skills, supported communication methods, and security requirements.
Agent Cards are published at /.well-known/agent-card.json and
allow clients to discover an agent's capabilities before interacting.
Defined Under Namespace
Classes: Capabilities, Interface, Provider, Skill
Instance Method Summary collapse
- #inspect ⇒ String
-
#name ⇒ String
Returns a human-readable name for the agent.
-
#description ⇒ String
Returns a human-readable description of the agent.
-
#version ⇒ String
Returns the agent version.
-
#protocol_version ⇒ String?
Returns the advertised A2A protocol version.
-
#documentation_url ⇒ String?
Returns the documentation URL, when present.
-
#icon_url ⇒ String?
Returns the icon URL, when present.
-
#skills ⇒ Array<LLM::A2A::Card::Skill>
Returns the skills provided by the agent.
-
#interfaces ⇒ Array<LLM::A2A::Card::Interface>
Returns the interfaces supported by the agent.
-
#capabilities ⇒ LLM::A2A::Card::Capabilities?
Returns the optional capabilities declaration.
-
#signatures ⇒ Array<LLM::Object>
Returns the agent card signatures.
-
#security_schemes ⇒ Hash<String, Hash>?
Returns the security scheme definitions.
-
#security_requirements ⇒ Array<Hash>?
Returns the security requirements.
-
#provider ⇒ LLM::A2A::Card::Provider?
Returns the declared provider information.
-
#default_input_modes ⇒ Array<String>
Returns the default input media types.
-
#default_output_modes ⇒ Array<String>
Returns the default output media types.
-
#initialize(data) ⇒ Card
constructor
A new instance of Card.
Constructor Details
Instance Method Details
#inspect ⇒ String
140 141 142 |
# File 'lib/llm/a2a/card.rb', line 140 def inspect "#<#{LLM::Utils.object_id(self)} @name=#{name.inspect} @skills=#{skills.size}>" end |
#name ⇒ String
Returns a human-readable name for the agent.
34 35 36 |
# File 'lib/llm/a2a/card.rb', line 34 def name @data.name end |
#description ⇒ String
Returns a human-readable description of the agent.
41 42 43 |
# File 'lib/llm/a2a/card.rb', line 41 def description @data.description end |
#version ⇒ String
Returns the agent version.
48 49 50 |
# File 'lib/llm/a2a/card.rb', line 48 def version @data.version end |
#protocol_version ⇒ String?
Returns the advertised A2A protocol version.
55 56 57 |
# File 'lib/llm/a2a/card.rb', line 55 def protocol_version @data.protocolVersion || @data.protocol_version end |
#documentation_url ⇒ String?
Returns the documentation URL, when present.
62 63 64 |
# File 'lib/llm/a2a/card.rb', line 62 def documentation_url @data.documentationUrl || @data.documentation_url end |
#icon_url ⇒ String?
Returns the icon URL, when present.
69 70 71 |
# File 'lib/llm/a2a/card.rb', line 69 def icon_url @data.iconUrl || @data.icon_url end |
#skills ⇒ Array<LLM::A2A::Card::Skill>
Returns the skills provided by the agent.
76 77 78 |
# File 'lib/llm/a2a/card.rb', line 76 def skills @skills ||= (@data.skills || []).map { Skill.new(_1) } end |
#interfaces ⇒ Array<LLM::A2A::Card::Interface>
Returns the interfaces supported by the agent.
83 84 85 |
# File 'lib/llm/a2a/card.rb', line 83 def interfaces @interfaces ||= (@data.supportedInterfaces || @data.supported_interfaces || []).map { Interface.new(_1) } end |
#capabilities ⇒ LLM::A2A::Card::Capabilities?
Returns the optional capabilities declaration.
90 91 92 93 |
# File 'lib/llm/a2a/card.rb', line 90 def capabilities raw = @data.capabilities raw ? Capabilities.new(raw) : nil end |
#signatures ⇒ Array<LLM::Object>
Returns the agent card signatures.
98 99 100 |
# File 'lib/llm/a2a/card.rb', line 98 def signatures @signatures ||= (@data.signatures || []).map { LLM::Object.from(_1) } end |
#security_schemes ⇒ Hash<String, Hash>?
Returns the security scheme definitions.
105 106 107 |
# File 'lib/llm/a2a/card.rb', line 105 def security_schemes @data.securitySchemes || @data.security_schemes end |
#security_requirements ⇒ Array<Hash>?
Returns the security requirements.
112 113 114 |
# File 'lib/llm/a2a/card.rb', line 112 def security_requirements @data.security || @data.security_requirements end |
#provider ⇒ LLM::A2A::Card::Provider?
Returns the declared provider information.
119 120 121 122 |
# File 'lib/llm/a2a/card.rb', line 119 def provider raw = @data.provider raw ? Provider.new(raw) : nil end |
#default_input_modes ⇒ Array<String>
Returns the default input media types.
127 128 129 |
# File 'lib/llm/a2a/card.rb', line 127 def default_input_modes @data.defaultInputModes || @data.default_input_modes || [] end |
#default_output_modes ⇒ Array<String>
Returns the default output media types.
134 135 136 |
# File 'lib/llm/a2a/card.rb', line 134 def default_output_modes @data.defaultOutputModes || @data.default_output_modes || [] end |