> ## 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.

# Idempotency Store Protocol • AI Agent SDK

> IdempotencyStoreProtocol: Protocol for inbound webhook/trigger delivery deduplication.

# IdempotencyStoreProtocol

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

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

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

<CardGroup cols={2}>
  <Card title="reserve()" icon="function" href="../functions/IdempotencyStoreProtocol-reserve">
    Atomically claim `key`; `False` if seen-or-in-flight.
  </Card>

  <Card title="record()" icon="function" href="../functions/IdempotencyStoreProtocol-record">
    Commit `key` as processed after a successful run.
  </Card>

  <Card title="release()" icon="function" href="../functions/IdempotencyStoreProtocol-release">
    Drop an in-flight reservation so a failed delivery can be retried.
  </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#L1738">
  `praisonaiagents/gateway/protocols.py` at line 1738
</Card>
