Agent Idempotency Key Enforcement

Reliability · updated Thu Feb 26

Ensure agentic tool calls are execution-safe by preventing duplicate operations during retries.

Steps

  1. Generate a unique `idempotency_key` for every distinct tool-call intent.
  2. Attach the key to the request header (e.g., `X-Idempotency-Key`).
  3. Store the key in the database alongside the initial request payload.
  4. Check for existing keys on the server-side before executing any 'write' operation.
  5. Return the original cached response if a duplicate key is detected.
  6. Set a TTL (Time-to-Live) for keys to prevent database bloat.

view raw JSON →