Drain Requested • AI Agent SDK

drain_requested: Return whether “marker“ is a live drain request for this instance.

drain_requested

Method

</div>

This is a method of the DrainMarkerPolicy class in the protocols module.

Return whether `marker` is a live drain request for this instance.

Signature

python
def drain_requested(marker: Optional[Dict[str, Any]], current_epoch: str, now: float) -> bool

Parameters

ParamField Optional

Parsed marker contents, or `None` when no marker file is present.

ParamField str

The current instantiation epoch (see :func:current_epoch).

ParamField float

A monotonic timestamp (unused by the default policy; accepted so subclasses can implement TTL/debounce without changing the call site).

Returns

ResponseField bool

`True` only for a non-stale, current-epoch drain request that has not already been handled.

Source

View on GitHub

praisonaiagents/gateway/protocols.py at line 5668