Class: A2A::InvalidAgentResponseError

Inherits:
JSONRPC::Error
  • Object
show all
Defined in:
lib/a2a/types/invalid_agent_response_error.rb

Overview

Error for invalid agent responses (-32006)

Raised when agent generates an invalid response for the requested method.

Examples:

Create an invalid agent response error

error = JSONRPC::InvalidAgentResponseError.new

Instance Method Summary collapse

Constructor Details

#initialize(message = 'Invalid agent response type.', data: nil, request_id: nil) ⇒ InvalidAgentResponseError

Creates a new Invalid Agent Response Error with code -32006

Examples:

Create an invalid agent response error with default message

error = JSONRPC::InvalidAgentResponseError.new

Create an invalid agent response error with exception details

error = JSONRPC::InvalidAgentResponseError.new(data: { response_type: 'malformed' }, request_id: 1)

Parameters:

  • message (String) (defaults to: 'Invalid agent response type.')

    short description of the error

  • data (Hash, Array, String, Number, Boolean, nil) (defaults to: nil)

    additional error information

  • request_id (String, Integer, nil) (defaults to: nil)

    the request identifier



28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/a2a/types/invalid_agent_response_error.rb', line 28

def initialize(
  message = 'Invalid agent response type.',
  data: nil,
  request_id: nil
)
  super(
    message,
    code: ErrorCodes::INVALID_AGENT_RESPONSE,
    data:,
    request_id:
  )
end