Class: A2A::Types::AgentCapabilities

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/a2a/types/agent_card.rb

Overview

Represents agent capabilities

Capabilities define what features and protocols the agent supports, such as streaming, push notifications, and extensions.

Examples:

Creating capabilities

capabilities = A2A::Types::AgentCapabilities.new(
  streaming: true,
  push_notifications: true,
  state_transition_history: false,
  extensions: ["custom-extension-1"]
)

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#==, #camelize, from_h, from_json, #hash, #to_h, #to_json, underscore, #valid?, #validate_array_type, #validate_inclusion, #validate_required, #validate_type

Constructor Details

#initialize(streaming: nil, push_notifications: nil, state_transition_history: nil, extensions: nil) ⇒ AgentCapabilities

Initialize new agent capabilities

Parameters:

  • (defaults to: nil)

    Whether the agent supports streaming responses

  • (defaults to: nil)

    Whether the agent supports push notifications

  • (defaults to: nil)

    Whether the agent maintains state history

  • (defaults to: nil)

    List of supported extension URIs



321
322
323
324
325
326
327
328
# File 'lib/a2a/types/agent_card.rb', line 321

def initialize(streaming: nil, push_notifications: nil, state_transition_history: nil, extensions: nil)
  @streaming = streaming
  @push_notifications = push_notifications
  @state_transition_history = state_transition_history
  @extensions = extensions

  validate!
end

Instance Attribute Details

#extensionsObject (readonly)

Returns the value of attribute extensions.



312
313
314
# File 'lib/a2a/types/agent_card.rb', line 312

def extensions
  @extensions
end

#push_notificationsObject (readonly)

Returns the value of attribute push_notifications.



312
313
314
# File 'lib/a2a/types/agent_card.rb', line 312

def push_notifications
  @push_notifications
end

#state_transition_historyObject (readonly)

Returns the value of attribute state_transition_history.



312
313
314
# File 'lib/a2a/types/agent_card.rb', line 312

def state_transition_history
  @state_transition_history
end

#streamingObject (readonly)

Returns the value of attribute streaming.



312
313
314
# File 'lib/a2a/types/agent_card.rb', line 312

def streaming
  @streaming
end

Instance Method Details

#push_notifications?Boolean

Check if push notifications are supported

Returns:

  • True if push notifications are supported



342
343
344
# File 'lib/a2a/types/agent_card.rb', line 342

def push_notifications?
  @push_notifications == true
end

#state_transition_history?Boolean

Check if state transition history is supported

Returns:

  • True if state history is supported



350
351
352
# File 'lib/a2a/types/agent_card.rb', line 350

def state_transition_history?
  @state_transition_history == true
end

#streaming?Boolean

Check if streaming is supported

Returns:

  • True if streaming is supported



334
335
336
# File 'lib/a2a/types/agent_card.rb', line 334

def streaming?
  @streaming == true
end

#supports_extension?(extension_uri) ⇒ Boolean

Check if a specific extension is supported

Parameters:

  • The extension URI to check

Returns:

  • True if the extension is supported



359
360
361
362
363
# File 'lib/a2a/types/agent_card.rb', line 359

def supports_extension?(extension_uri)
  return false if @extensions.nil?

  @extensions.include?(extension_uri)
end

#validate!Object (private)



367
368
369
370
371
372
# File 'lib/a2a/types/agent_card.rb', line 367

def validate!
  validate_type(:streaming, [TrueClass, FalseClass]) if @streaming
  validate_type(:push_notifications, [TrueClass, FalseClass]) if @push_notifications
  validate_type(:state_transition_history, [TrueClass, FalseClass]) if @state_transition_history
  validate_array_type(:extensions, String) if @extensions
end