Skip to main content

AttemptAndAgeDeadLetterPolicy

Defined in the protocols module.
AI Agent Default dead-letter policy: require BOTH attempt-exhaustion AND age. Distinguishes a poison message (fails repeatedly over a long time) from a transient outage (fails a few times quickly, then recovers). A recoverable/transient failure is dead-lettered only once it satisfies both:
  1. attempts >= max_attempts, and
  2. age >= min_age_seconds (wall-clock age since first receipt).
Until an entry is genuinely old it keeps retrying under capped backoff rather than being discarded, so a brief channel incident results in delayed-but-delivered messages rather than a DLQ full of manual-replay work. A truly poisoned entry still dead-letters — it keeps failing past both thresholds. An error whose error_class is known-permanent (see :data:PERMANENT_ERROR_CLASSES — a revoked credential or a permanently invalid target) short-circuits to dead-letter immediately regardless of age, since retrying can never recover it. min_age_seconds=0 restores the legacy attempt-count-only behaviour, keeping the knob fully backward-compatible for callers that opt in. Example::

Constructor

int
default:"5"
No description available.
int
default:"DEFAULT_MIN_AGE_SECONDS"
No description available.

Properties

int
No description available.

Methods

should_dead_letter()

Instance method.

Source

View on GitHub

praisonaiagents/gateway/protocols.py at line 3867