skip to content

What must a model gateway's logged request contain so it can be replayed faithfully on another model months later?

level: middleimportance: should knowfreq 40%

answer

  1. names drift, snapshots do not
  2. effective values, not supplied ones
  3. rendered prompt plus its version
  4. tool definitions travel with it
  5. keep the original answer

basics

~20 s

The exact rendered messages, the resolved dated model rather than an alias, every effective parameter including defaults, the full tool definitions and tool mode, any output schema, the prompt version, and the original response as a baseline.

solid answer

~40 s

A replay re-sends the same input, so the record must pin everything that can drift. That means the messages as actually sent, retrieved text included, not a template name plus variables; the resolved model and its dated snapshot, not the alias, because aliases get repointed; the effective value of every parameter, including defaults the gateway or provider filled in, and any parameter the gateway dropped; the full tool definitions, the tool-choice mode and any output schema, stored by content or by hash into a versioned store; the prompt version, so results can be grouped; and the original response with its finish reason, tool calls and usage, which is the baseline. Anything held only by reference, such as an image link that expires, must be copied, or the record silently stops being replayable.

code

json · 29 lines
json
{
  "record_id": "gw-7f3a91",
  "logged_at": "2026-10-09T14:02:11Z",
  "route": "support-reply-drafts",
  "caller_team": "support-tools",
  "correlation_id": "req-55e2c0",
  "requested_model": "drafting-default",
  "resolved_model": "provider-b/model-x@2026-06-01",
  "fallback_hop": 0,
  "prompt_version": "reply-draft@v14",
  "effective_params": {
    "temperature": 0.2,
    "output_token_limit": 800,
    "seed": 11
  },
  "gateway_transforms": ["dropped: repetition-control parameter"],
  "system_prompt_hash": "sha256:4b1d...",
  "tool_definitions_hash": "sha256:9c1e...",
  "tool_mode": "auto",
  "output_schema_hash": "sha256:e07a...",
  "messages_ref": "body-store/support-reply-drafts/gw-7f3a91",
  "response": {
    "finish": "stop",
    "output_ref": "body-store/support-reply-drafts/gw-7f3a91/out",
    "tool_calls": [],
    "usage": {"tokens_in": 1812, "tokens_out": 264}
  },
  "replayable": true
}

go deeper

for a junior

Recall the core list: the rendered messages, the resolved model, all parameters, the tools, and the original answer.

for a middle

Explain what drifts between the call and the replay, such as aliases, templates, defaults, tool schemas and the retrieval index, and which field pins each one.

for a senior

Show the storage design: content-addressed prompts and tool definitions, attachments copied at call time, and a write-time check that marks each record replayable or not.

for a principal

Decide which routes must keep replayable records at all, since that choice fixes which features can later be migrated on replay evidence.

A **replay** re-sends logged requests to a different model, or to the same model with a different prompt, and compares the answers. It only means something if the replayed request is the request that originally ran. Months can pass between the call and the replay, and almost everything around a call drifts in that time, so a replayable record has to **pin** each moving part at the moment of the call. ## What drifts between the call and the replay - **Model aliases.** A gateway alias such as `drafting-default` is a pointer that gets repointed. Replaying the alias tests whatever it points at today. - **Prompt templates.** Templates are edited in place. A template name plus last month's variables renders today's wording. - **Defaults.** Parameters the caller omitted were filled in by the gateway or the provider, and those defaults can change between releases. - **Tool definitions and output schemas.** Tools gain and lose fields and change descriptions; a structured-output schema gets revised. - **Retrieved context.** The retrieval index that supplied documents has since been updated; running retrieval again returns different text. - **Attachments by reference.** An image or file passed as a link may have expired. - **The gateway's own transformations.** A parameter that was dropped or emulated for one provider changed what was really sent. ## The fields | Field | Why it is needed | Trap if missing | |---|---|---| | Rendered messages as sent | the actual input, retrieved text included | replaying a template that has changed | | Resolved model and dated snapshot | the model that answered | testing whatever the alias points at now | | Provider or host | the same weights can behave differently on another host | blaming the model for a hosting difference | | Effective parameters | temperature, output-token limit, seed, stop sequences, as applied | defaults that changed silently | | Tool definitions, tool mode, output schema | the model's available actions and required shape | the candidate sees a different toolset | | Gateway transformations | what was dropped, mapped or emulated | the baseline ran under different rules | | Prompt version and route | grouping and attribution | results you cannot slice | | Original response | text, tool calls, finish reason, usage | no baseline to compare against | | Fallback hop | which entry in a fallback chain answered | comparing against the wrong model | The template version and its variables are worth logging too, beside the rendered messages, so results can be grouped by prompt version. They are labels for the replay, not its input. ## Storing it without storing everything twice Full records are large, and most of their bulk repeats: a route's system prompt and tool definitions are identical across millions of calls. Two techniques keep the cost down: 1. **Content addressing.** Store each distinct system prompt, tool-definition set and output schema once, keyed by a hash of its content, and put only the hash in the record. A content hash cannot be repointed the way a name can. 2. **Copy what is referenced.** Attachments and documents passed by link are copied into the body store at call time, or the record is marked as not replayable. A cheap write-time check helps: the gateway confirms that every hash it wrote resolves, and flags a record that depends on something it did not keep. The `replayable` field in the example record is that flag. ## What even a perfect record cannot pin - **Sampling.** At non-zero temperature the same request gives different answers on the same model. A seed narrows this where a provider accepts one, but some providers describe seeded output as best effort rather than guaranteed. - **Provider-side change.** A provider can change serving details behind a model name, and a retired model cannot be re-run at all. The logged response is then the only surviving record of the old behaviour. - **The world the tools touched.** A logged tool result describes the state of a system at call time, not now. That is why the original response is part of the record, and why a comparison usually starts by rerunning the incumbent model on the same requests to measure how much its own answers vary; comparing answers without labels is a question of its own. ## Why this is a design decision, not a detail Routes that log metadata only cannot be replayed at all, and routes whose records lack any one of the fields above produce replays that quietly test something else. Deciding which routes keep replayable records decides, months in advance, which features can be migrated on replay evidence.

  • Why is a prompt template name plus its variables not enough to replay a call?
    Templates are edited in place, so replaying the template name with last month's variables sends today's wording and tests a prompt nobody ran. Keep the rendered messages as the replay input; log the template version and variables beside them to group and diff results.
  • The record holds the parameters the caller sent. Why can that still be unfaithful?
    Omitted parameters were filled with defaults by the gateway or the provider, and those defaults can change between releases. Record the effective value of each parameter at call time, plus any parameter the gateway dropped or emulated, so the replay sends what the original call actually ran with.

  • Logging the model alias is enough, because it names the model the team chose.
  • A prompt template name and its variables reproduce the prompt exactly.
  • Only parameters the caller set need logging; the rest are just defaults.
  • Retrieved context can be fetched again at replay time from the same index.
  • Tool names are enough; their definitions can be looked up later.