a2a.compat.v0_3.rest_handler moduleÂķ
- class a2a.compat.v0_3.rest_handler.REST03Handler(request_handler: RequestHandler)Âķ
Bases:
objectMaps incoming REST-like (JSON+HTTP) requests to the appropriate request handler method and formats responses for v0.3 compatibility.
- async get_push_notification(request: Request, context: ServerCallContext) dict[str, Any]Âķ
Handles the âtasks/pushNotificationConfig/getâ REST method.
- Parameters:
request â The incoming Request object.
context â Context provided by the server.
- Returns:
A dict containing the config in v0.3 format.
- async list_push_notifications(request: Request, context: ServerCallContext) dict[str, Any]Âķ
Handles the âtasks/pushNotificationConfig/listâ REST method.
- async on_cancel_task(request: Request, context: ServerCallContext) dict[str, Any]Âķ
Handles the âtasks/cancelâ REST method.
- Parameters:
request â The incoming Request object.
context â Context provided by the server.
- Returns:
A dict containing the updated Task in v0.3 format.
- async on_get_extended_agent_card(request: Request, context: ServerCallContext) dict[str, Any]Âķ
Handles the âv1/agent/authenticatedExtendedAgentCardâ REST method.
- async on_get_task(request: Request, context: ServerCallContext) dict[str, Any]Âķ
Handles the âv1/tasks/{id}â REST method.
- Parameters:
request â The incoming Request object.
context â Context provided by the server.
- Returns:
A Task object containing the Task in v0.3 format.
- async on_message_send(request: Request, context: ServerCallContext) dict[str, Any]Âķ
Handles the âmessage/sendâ REST method.
- Parameters:
request â The incoming Request object.
context â Context provided by the server.
- Returns:
A dict containing the result (Task or Message) in v0.3 format.
- on_message_send_stream(request: Request, context: ServerCallContext) AsyncIterator[dict[str, Any]]Âķ
Handles the âmessage/streamâ REST method.
- Parameters:
request â The incoming Request object.
context â Context provided by the server.
- Yields:
JSON serialized objects containing streaming events in v0.3 format.
- on_subscribe_to_task(request: Request, context: ServerCallContext) AsyncIterator[dict[str, Any]]Âķ
Handles the âtasks/{id}:subscribeâ REST method.
- Parameters:
request â The incoming Request object.
context â Context provided by the server.
- Yields:
JSON serialized objects containing streaming events in v0.3 format.
- async set_push_notification(request: Request, context: ServerCallContext) dict[str, Any]Âķ
Handles the âtasks/pushNotificationConfig/setâ REST method.
- Parameters:
request â The incoming Request object.
context â Context provided by the server.
- Returns:
A dict containing the config object in v0.3 format.