> ## Documentation Index
> Fetch the complete documentation index at: https://praison.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Dead Letter Policy Protocol • AI Agent SDK

> DeadLetterPolicyProtocol: Protocol for the durable-queue dead-letter decision.

# DeadLetterPolicyProtocol

> Defined in the [**protocols**](../modules/protocols) module.

<Badge color="blue">AI Agent</Badge>

Protocol for the durable-queue dead-letter decision.

Pure, import-free decision contract consumed by the outbound queue's
`drain` and the inbound journal's redelivery/replay paths. The runtime
supplies typed facts about a repeatedly-failing entry (its `attempts`,
the `first_seen_epoch` it was first received, the current `now_epoch`,
and a coarse `error_class`) and the policy returns a
:class:`DeadLetterDecision`. Concrete queue state and side effects (SQLite
rows, DLQ enqueue) stay in the implementation; this keeps the *policy*
injectable and testable in isolation, symmetric with
:class:`SendPolicyProtocol` / :class:`RateLimitPolicyProtocol`.

A config-driven default (:class:`AttemptAndAgeDeadLetterPolicy`) is
provided for the common "poison vs transient" case.

## Methods

<CardGroup cols={2}>
  <Card title="should_dead_letter()" icon="function" href="../functions/DeadLetterPolicyProtocol-should_dead_letter">
    Return a :class:`DeadLetterDecision` for the supplied facts.
  </Card>
</CardGroup>

## Source

<Card title="View on GitHub" icon="github" href="https://github.com/MervinPraison/PraisonAI/blob/main/src/praisonai-agents/praisonaiagents/gateway/protocols.py#L3838">
  `praisonaiagents/gateway/protocols.py` at line 3838
</Card>
