7 Practices for Building Reliable Webhooks: Store-Then-Ack, Idempotency, Circuit Breakers
arpit_bhayani · x · 2026-11-30
Arpit Bhayani shares 7 foundational distributed-systems practices for making webhooks reliable when building agents that interact with external systems:
- Store before you ack: only return 2xx after the hook is durably written (a simple fsync works); return 503 with Retry-After otherwise so the provider retries instead of losing events.
- Decouple ingest from delivery: the request handler should only verify the hook, persist it, and reply—let a dispatcher deliver to sinks (broker, HTTP endpoint, agent) with its own retries and backoff.
- Verify signatures, but quarantine on failure: a wrong secret in config is common, so hold failed-verification hooks and replay them after the fix.
- Assume at-least-once delivery: attach an idempotency key to every delivery so workers dedupe—critical for agents, where duplicate events trigger duplicate actions.
- Handle down sinks: use per-sink circuit breakers (park after 5 consecutive failures without consuming retries); dead-lettered hooks should be listable and replayable as rate-limited, cancellable jobs.
- Move massive payloads to object storage.
- Isolate tenants: per-tenant quotas (429 + Retry-After) and queue caps so one flooding tenant can't 503 everyone else.
More from coding & agent
- Dev claims open-source AI pentesting agent took down 3 staging environments — MicahBerkley · 2026-12-01
- Claude eng lead Felix Rieseberg shares a 4-step prompt for deeper AI output — CatAstro_Piyush · 2026-12-01
- Managing AI agents with 'High Output Management' sparks AI-circle mockery — Kyrannio · 2026-12-01
- What Blobasaur teaches about engineering judgment in the AI-assisted development era — _jaydeepkarale · 2026-12-01
- Zerodha open-sources Blobasaur: a distributed blob store in Rust, SQLite and Redis protocol — _jaydeepkarale · 2026-12-01
- Kiro launches Shared Crew: one AI agent workspace with shared memory for whole teams — gdequeiroz · 2026-12-01