skip to content

How do you keep a bulk replay of gateway-logged traffic from firing side effects, exhausting provider quota or polluting production cost and quality figures?

level: seniorimportance: should knowfreq 30%

answer

  1. a replay is a tenant too
  2. outputs recorded, never executed
  3. its own key, cap and pace
  4. tag every replay request
  5. keep it out of the next replay

basics

~20 s

Treat the replay as a separate tenant: outputs are recorded but never executed or delivered, it runs on its own key and cap at a paced rate, and every request carries a replay tag that dashboards, health checks and future samples exclude.

solid answer

~40 s

A replay re-sends production requests, so anything that reacts to production requests reacts to it. I run it through a dedicated route that only records outputs: tool calls the candidate emits are compared, never executed, and nothing goes to users or delivery hooks. It uses its own gateway key with its own spend cap and a rate ceiling set below the headroom production needs at peak, ideally on separate provider quota, run off-peak or through an asynchronous batch endpoint where one exists. Response caching is bypassed, or the replay may measure the cache instead of the model. Every request carries a replay tag and run id, so cost and quality dashboards, alerting and provider health signals exclude it, and its records never feed the next replay or an evaluation sample.

code

yaml · 21 lines
yaml
# Illustrative replay route; every field name is invented, not one product's.
route: replay-support-reply-drafts
source_route: support-reply-drafts
mode: record_only            # responses stored, returned to no caller
execute_tool_calls: false
delivery_hooks: disabled
response_cache: bypass
gateway_key: replay-key-support
spend_cap_usd: 1500
rate_ceiling:
  input_tokens_per_minute: 500000
  priority: low              # production traffic preempts replay
tags:
  replay: true
  run_id: replay-2026-10-14-candidate-b
exclude_from:
  - provider_health
  - alerting
  - cost_dashboards
  - replay_sampling
logging_tier: inherit_source_route

go deeper

for a junior

Recall the three risks: actions taken on replayed requests, quota and spend taken from production, and dashboards counting replay as real traffic.

for a middle

Explain the guards: a record-only route, its own key and cap, a paced send rate, bypassed response caching and a replay tag on every request.

for a senior

Do the pacing arithmetic against the provider limit and production's peak, and keep replay out of health signals, alerts and future samples.

for a principal

Decide whether replay gets separate provider quota or shares production's, and who may launch a replay of another team's logged traffic.

A **bulk replay** re-sends a large batch of logged production requests, say a week of one route's traffic, to a candidate model or prompt. To everything around the gateway, those requests look like production. Anything that reacts to production requests will react to the replay unless the replay is built to be invisible to it. ## How a replay leaks into production - **Side effects.** Responses can trigger downstream hooks, notifications or post-processing, and tool calls in a response may be executed by whatever consumes them. - **Provider quota.** A provider account's tokens-per-minute and requests-per-minute limits are shared; a fast replay throttles live users. - **Spend caps.** Replay spend drawn on a team's production key can exhaust the cap the live feature depends on. - **Dashboards and alerts.** Replay calls inflate cost, shift latency and quality figures, and can page someone. - **Health signals.** Errors or throttling the replay draws can eject a provider from rotation and send real users to a fallback. - **Response caches.** A cache whose key ignores the model, or one that matches similar prompts, can answer the replay with a stored response, so you measure the cache, not the model. - **Recursion.** Replay records written into the same log become part of the next replay or of an evaluation sample. ## Side effects: a record-only route 1. Send replay traffic through a **dedicated replay route** that stores the candidate's response and returns it to no caller. 2. **Never execute tool calls** the candidate emits; compare them as outputs. 3. **Disable delivery hooks** on that route: no webhooks, callbacks or notifications. 4. **Bypass response caching** on the replay route, and confirm in each record that a provider call was made. ## Quota and pacing Do the arithmetic before launching. In one scenario, a route logged 2.1 million requests last week averaging 1,500 input tokens: 3.15 billion input tokens. Sent within 24 hours, that is about 2.19 million input tokens per minute (3.15 billion divided by 1,440 minutes). If production already peaks at 1.4 million of a 2 million tokens-per-minute account limit (also scenario figures), the replay has at most 0.6 million to spare at peak, and many such limits count output tokens as well. At a steady 0.5 million input tokens per minute the full week takes 6,300 minutes: 105 hours, or about 4.4 days. The usual responses: - **Replay a sample** rather than the whole week; how to choose that sample is an evaluation-dataset question. - **Use separate provider quota,** another key, account or region, so the replay cannot touch production's headroom. - **Pace below a ceiling** computed from production's peak, and give replay a lower priority so production preempts it; run it off-peak. - **Use an asynchronous batch endpoint** where the provider offers one, which often carries its own quota and price. ## Keeping figures clean | Consumer | What goes wrong | Guard | |---|---|---| | Spend caps | replay drains the team's production cap | a replay key with its own cap | | Cost dashboards | replay counted as feature spend | filter on the replay tag | | Quality and latency figures | replay shifts the averages | filter on the replay tag | | Alerting | a burst of replay errors pages on-call | alert rules exclude replay | | Provider health | replay throttling ejects a provider | health counts production traffic only | | Future replays and eval samples | a replay of a replay | replay records kept out of sampling sources | Every replay request carries a **replay tag** and a **run id**, set by the replay job and enforced by the replay route, so no consumer has to guess which traffic was real. ## A launch checklist - Record-only route, response cache bypassed, delivery hooks off. - Its own gateway key and spend cap, and separate provider quota where possible. - A rate ceiling computed from production's peak, not its average. - A replay tag and run id on every request; dashboards, alerts and health checks filter on them. - Outputs stored with the run, inheriting the source route's logging tier and read rules. - A kill switch the on-call engineer can pull if production throttling rises. Live shadow traffic, which mirrors requests as they happen, has similar isolation needs but different timing; it belongs to online evaluation, not to replay of logged traffic.

  • Why must replay errors be kept out of provider health signals?
    A replay pushing a provider hard can draw throttling or errors that, counted with production traffic, eject that provider from rotation and send real users to a fallback. Health signals should count production traffic only, or the replay should run on its own keys so its failures stay its own.
  • Half the replayed answers are identical to the logged ones, character for character. What do you check first?
    Whether a response cache served them. A cache whose key ignores the model, or one that matches similar prompts, returns the stored answer without calling the candidate, so the replay measures the cache. Bypass caching on the replay route and confirm in each record that a provider call was made.

  • The gateway never runs tools, so a replay can never have side effects.
  • Replay traffic can share the production key, since it is internal anyway.
  • Running the replay as fast as possible gets it out of the way sooner.
  • Replay requests are few enough that dashboards will average them out.
  • Replay records can go into the same log that future replays sample from.