drain • AI Agent SDK
drain: Process pending messages.
drain
Async
Method
</div>
This is a method of the OutboundDeliveryProtocol class in the protocols module.
Process pending messages.
Called on startup to retry unsent messages. Messages are processed oldest-first to maintain order.
Signature
async def drain(sender: Callable[[str, Dict[str, Any]], Awaitable[bool]], limit: Optional[int]) -> tuple[int, int]Parameters
ParamField
CallableAsync function that attempts delivery. Should return True on success, False to retry later.
ParamField
Optional[int]Optional max messages to process
Returns
ResponseField
tuple[int, int]Tuple of (succeeded, failed) counts
Source
View on GitHubpraisonaiagents/gateway/protocols.py at line 2087