Class: A2A::Server::RequestHandler
- Inherits:
-
Object
- Object
- A2A::Server::RequestHandler
- Defined in:
- lib/a2a/server/request_handler.rb
Overview
Abstract base class for A2A request handlers
This interface defines the methods that an A2A server implementation must provide to handle incoming JSON-RPC requests. It mirrors the Python RequestHandler interface for consistency.
Direct Known Subclasses
Instance Method Summary collapse
-
#on_cancel_task(params, context = nil) ⇒ A2A::Types::Task?
abstract
Handle the 'tasks/cancel' method.
-
#on_delete_task_push_notification_config(params, context = nil) ⇒ void
abstract
Handle the 'tasks/pushNotificationConfig/delete' method.
-
#on_get_task(params, context = nil) ⇒ A2A::Types::Task?
abstract
Handle the 'tasks/get' method.
-
#on_get_task_push_notification_config(params, context = nil) ⇒ A2A::Types::TaskPushNotificationConfig
abstract
Handle the 'tasks/pushNotificationConfig/get' method.
-
#on_list_task_push_notification_config(params, context = nil) ⇒ Array<A2A::Types::TaskPushNotificationConfig>
abstract
Handle the 'tasks/pushNotificationConfig/list' method.
-
#on_message_send(params, context = nil) ⇒ A2A::Types::Task, A2A::Types::Message
abstract
Handle the 'message/send' method (non-streaming).
-
#on_message_send_stream(_params, _context = nil) ⇒ Enumerator
abstract
Handle the 'message/stream' method (streaming).
-
#on_resubscribe_to_task(_params, _context = nil) ⇒ Enumerator
abstract
Handle the 'tasks/resubscribe' method.
-
#on_set_task_push_notification_config(params, context = nil) ⇒ A2A::Types::TaskPushNotificationConfig
abstract
Handle the 'tasks/pushNotificationConfig/set' method.
Instance Method Details
#on_cancel_task(params, context = nil) ⇒ A2A::Types::Task?
Subclasses must implement this method
Handle the 'tasks/cancel' method
Requests the agent to cancel an ongoing task.
38 39 40 |
# File 'lib/a2a/server/request_handler.rb', line 38 def on_cancel_task(params, context = nil) raise NotImplementedError, "Subclasses must implement on_cancel_task" end |
#on_delete_task_push_notification_config(params, context = nil) ⇒ void
Subclasses must implement this method
This method returns an undefined value.
Handle the 'tasks/pushNotificationConfig/delete' method
Deletes a push notification configuration associated with a task.
131 132 133 |
# File 'lib/a2a/server/request_handler.rb', line 131 def on_delete_task_push_notification_config(params, context = nil) raise NotImplementedError, "Subclasses must implement on_delete_task_push_notification_config" end |
#on_get_task(params, context = nil) ⇒ A2A::Types::Task?
Subclasses must implement this method
Handle the 'tasks/get' method
Retrieves the state and history of a specific task.
25 26 27 |
# File 'lib/a2a/server/request_handler.rb', line 25 def on_get_task(params, context = nil) raise NotImplementedError, "Subclasses must implement on_get_task" end |
#on_get_task_push_notification_config(params, context = nil) ⇒ A2A::Types::TaskPushNotificationConfig
Subclasses must implement this method
Handle the 'tasks/pushNotificationConfig/get' method
Retrieves the current push notification configuration for a task.
92 93 94 |
# File 'lib/a2a/server/request_handler.rb', line 92 def on_get_task_push_notification_config(params, context = nil) raise NotImplementedError, "Subclasses must implement on_get_task_push_notification_config" end |
#on_list_task_push_notification_config(params, context = nil) ⇒ Array<A2A::Types::TaskPushNotificationConfig>
Subclasses must implement this method
Handle the 'tasks/pushNotificationConfig/list' method
Retrieves the current push notification configurations for a task.
118 119 120 |
# File 'lib/a2a/server/request_handler.rb', line 118 def on_list_task_push_notification_config(params, context = nil) raise NotImplementedError, "Subclasses must implement on_list_task_push_notification_config" end |
#on_message_send(params, context = nil) ⇒ A2A::Types::Task, A2A::Types::Message
Subclasses must implement this method
Handle the 'message/send' method (non-streaming)
Sends a message to the agent to create, continue, or restart a task, and waits for the final result (Task or Message).
52 53 54 |
# File 'lib/a2a/server/request_handler.rb', line 52 def (params, context = nil) raise NotImplementedError, "Subclasses must implement on_message_send" end |
#on_message_send_stream(_params, _context = nil) ⇒ Enumerator
Subclasses must implement this method
Handle the 'message/stream' method (streaming)
Sends a message to the agent and yields stream events as they are produced (Task updates, Message chunks, Artifact updates).
66 67 68 |
# File 'lib/a2a/server/request_handler.rb', line 66 def (_params, _context = nil) raise A2A::Errors::UnsupportedOperation, "Streaming not supported by this handler" end |
#on_resubscribe_to_task(_params, _context = nil) ⇒ Enumerator
Subclasses must implement this method
Handle the 'tasks/resubscribe' method
Allows a client to re-subscribe to a running streaming task's event stream.
105 106 107 |
# File 'lib/a2a/server/request_handler.rb', line 105 def on_resubscribe_to_task(_params, _context = nil) raise A2A::Errors::UnsupportedOperation, "Task resubscription not supported by this handler" end |
#on_set_task_push_notification_config(params, context = nil) ⇒ A2A::Types::TaskPushNotificationConfig
Subclasses must implement this method
Handle the 'tasks/pushNotificationConfig/set' method
Sets or updates the push notification configuration for a task.
79 80 81 |
# File 'lib/a2a/server/request_handler.rb', line 79 def on_set_task_push_notification_config(params, context = nil) raise NotImplementedError, "Subclasses must implement on_set_task_push_notification_config" end |