Dead Letter Policy Protocol • AI Agent SDK
DeadLetterPolicyProtocol: Protocol for the durable-queue dead-letter decision.
DeadLetterPolicyProtocol
Defined in the protocols module.
AI Agent
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
Source
View on GitHubpraisonaiagents/gateway/protocols.py at line 5451