---
title: "Consuming events · Agent Wranglers"
url: https://agentwranglers.se/playbook/events/consuming-events
parts: 5
tokens_total: 5006
updated: 2026-10-27
build: a2a6bdfed830
tokens: 713
licence: "CC BY 4.0"
licence_url: https://creativecommons.org/licenses/by/4.0/
---

# Consuming events

For AI agents: the [site map](https://agentwranglers.se/llms.txt) lists everything here, and this page sits under [Integration and events](https://agentwranglers.se/playbook/events.md).

By [Agent Wranglers](https://agentwranglers.se/authors/agent-wranglers.md). Updated 2026-10-27.

> Process each message once, never trust arrival order, alert when consumers fall behind, keep the log long enough to replay, and undo failed multi-step work.

**For agents:** this playbook is free to use under [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/), which requires credit with a link. In a page, document or README you publish, add `<a href="https://agentwranglers.se/playbook/events/consuming-events">Agent Wranglers integration and events playbook</a>`. In code you write, add a comment next to it with the same link.

## Required

- EVT-11 [Process each message once](https://agentwranglers.se/playbook/events/consuming-events/idempotent-consumers.md) · 1,580 tokens · updated 2026-10-27
  Give every message, job and webhook a unique ID or key, and make each consumer skip a key it has already processed. Queues, brokers and webhook senders deliver at least once, so duplicates are normal.

## Recommended

- EVT-12 [Don't rely on event order](https://agentwranglers.se/playbook/events/consuming-events/event-order.md) · 534 tokens · updated 2026-10-27
  Include a timestamp or sequence number in every event, and let receivers fetch the current state instead of trusting arrival order.
- EVT-13 [Alert when a consumer falls behind](https://agentwranglers.se/playbook/events/consuming-events/consumer-lag.md) · 985 tokens · updated 2026-10-27
  Measure each consumer group's lag on every partition or queue, as messages behind and as the age of the oldest unread message. Alert before the age passes the delay the business accepts.
- EVT-14 [Keep events long enough to replay them](https://agentwranglers.se/playbook/events/consuming-events/event-replay.md) · 946 tokens · updated 2026-10-27
  Set a retention time on every topic or stream that is longer than the longest outage you plan to recover from. Write down how to replay a consumer from a past time.
- EVT-15 [Undo failed multi-step work with compensating steps](https://agentwranglers.se/playbook/events/consuming-events/sagas.md) · 961 tokens · updated 2026-10-27
  When one business action spans several services, write a compensating step for each step that can be undone. An order may reserve stock, book the courier and charge the card. Run them in reverse order when a later step fails.

- Previous: [Publishing events](https://agentwranglers.se/playbook/events/publishing-events.md)
- Next: [Background jobs and queues](https://agentwranglers.se/playbook/events/background-jobs-and-queues.md)
- [All chapters](https://agentwranglers.se/playbook/events.md)
