File size: 709 Bytes
6155b26 754345f 6155b26 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | from abc import ABC, abstractmethod
import httpx
from agent.messaging.models import (
DestinationConfig,
NotificationRequest,
NotificationResult,
)
class NotificationError(Exception):
"""Delivery failed and should not be retried."""
class RetryableNotificationError(NotificationError):
"""Delivery failed transiently and can be retried."""
class NotificationProvider(ABC):
provider_name: str
@abstractmethod
async def send(
self,
client: httpx.AsyncClient,
destination_name: str,
destination: DestinationConfig,
request: NotificationRequest,
) -> NotificationResult:
"""Deliver a notification to one destination."""
|