Idempotency Store Protocol • AI Agent SDK

IdempotencyStoreProtocol: Protocol for inbound webhook/trigger delivery deduplication.

IdempotencyStoreProtocol

Defined in the protocols module.

AI Agent

Protocol for inbound webhook/trigger delivery deduplication.

The gateway’s inbound HTTP hook surface must not start a second agent run for an event a provider re-delivers (webhook providers routinely retry for minutes to days). Deduplication is a three-step, restart-stable claim on the deterministic idempotency key (`compute_idempotency_key`):

  • `reserve — atomically claim the key. Returns False` when the key
  • was already recorded or is currently in flight, so both a redelivery
  • and a concurrent duplicate are rejected.
  • `record` — commit the key after a successful run so future
  • redeliveries dedup.
  • `release` — drop an in-flight reservation after a failed run so the
  • provider’s retry can re-run.

This mirrors :class:CallbackPayloadStoreProtocol: the contract lives in core so third-party gateways and a future `redis backend interoperate; core ships the bounded in-memory default (:class:InMemoryIdempotencyStore) and the durable, restart-surviving SQLite backend lives in the praisonai-bot` runtime (as the ingress journal and outbound queue do).

Methods

Source

View on GitHub

praisonaiagents/gateway/protocols.py at line 2128