Queued agent pipelines break in three predictable ways: retry storms multiply load exactly when capacity is lowest, side effects fire twice after a timeout that was not really a failure, and backlog grows past the point where any replay is safe. None of these are model problems. All three are queue contracts that were never written down.
Backpressure only works when it is driven by signals the consumer actually emits, not by producer-side guesses about load. A defensible contract reads three signals: p95 processing time, sliding-window error ratio, and consumer lag.
| Signal | Threshold | Action |
|---|---|---|
| Processing time p95 | Greater than 2x baseline | Reduce dispatch rate 40 percent |
| Error ratio | Greater than 5 percent sliding window | consumer, drain to dead-letter |
| Consumer lag | Greater than 200 tasks | Throttle new dispatch, raise alert |
Recovery is explicit rather than automatic. Producer rate returns to baseline only after lag falls below 110 percent of capacity for one full evaluation window. Hysteresis prevents the loop from oscillating between throttle and full rate.
An idempotency ledger records the intent to mutate before the mutation runs. Each task carries a globally unique identifier assigned at dispatch and retained through every retry and state transition. Before a handler executes a write, it checks the ledger.
The ledger is a small table, not a distributed cache. It must be transactional with the write it guards, because a ledger that can disagree with the effect it recorded is worse than no ledger at all.
Replaying a backlog after an incident is where duplicate side effects hide. A dry-run gate makes replay safe to run more than once.
Queue depth alone is not telemetry. Useful dashboards pair depth with p95 processing time, error ratio, and retry depth distribution, so an operator can tell a healthy full queue from a failing one. Publishing these three series per pipeline is enough to diagnose the next incident without adding instrumentation retroactively.
Referensi akademis untuk kontrak idempotensi, semantik exactly-once, dan orkestrasi workflow:
Blueprint teknis dan arsitektur telemetri workflow terkait didokumentasikan di rausalbahtiar.dev/blog.