Prompt & Context Engineering·Question 25 of 68Intermediate

How do you version and govern prompts in production? Someone asks which prompt produced a bad output three weeks ago - can you answer?

Type it the way you would explain it to an interviewer. A few sentences is enough; you can't break anything.

Model answer: the part to lead with

If you cannot answer that question, you do not have a prompt system, you have prompt strings. The fix is to treat prompts as versioned artifacts with immutable ids and to log the id on every request.

Full worked answer

If you cannot answer that question, you do not have a prompt system, you have prompt strings. The fix is to treat prompts as versioned artifacts with immutable ids and to log the id on every request.

The key insight most candidates miss: the prompt is not the deployable unit. The deployable unit is the tuple of (prompt template, model id, sampling params, tool schemas, output schema). A prompt validated against one model is not validated against the next version of that model. Version them together as one artifact with one id, or you will get silent regressions when someone bumps the model and the prompt version stays put.

What I log per request: artifact_version, the rendered prompt hash, model id, params, and the trace of retrieved doc ids and tool results. Hash rather than the full prompt if the rendered prompt contains user data you cannot retain, but keep enough to reproduce. Reproduction is the whole point.

Storage: prompts owned by engineers live in git and ship with the code, which gives you review, diffs, blame, and atomic rollout with the code that depends on them. The moment non-engineers need to edit prompts, you need a registry with a UI, and then you need the governance to go with it: an approval step, an eval gate that blocks promotion on a regression, and an audit trail of who approved what with which scores.

Routing: use labels, not hardcoded versions. production points at a version, staging at another. Rollback is repointing a label, which takes seconds and needs no deploy. This is the single most valuable property of a registry, and it is why teams outgrow prompts-in-env-vars.

The anti-patterns to name: prompts as environment variables (no history, no diff), a dashboard where anyone can edit production text with no eval gate, and prompts duplicated across three services that drift.

What a good answer covers

  • If you cannot answer that question, you do not have a prompt system, you have prompt strings
  • The fix is to treat prompts as versioned artifacts with immutable ids and to log the id on every request
  • The deployable unit is the tuple of (prompt template, model id, sampling params, tool schemas, output schema)
  • A prompt validated against one model is not validated against the next version of that model
  • Version them together as one artifact with one id, or you will get silent regressions when someone bumps…

Interviewer follow-ups to expect

  1. Why is a prompt tested on one model not validated on a newer version of the same model?

  2. How would you gate promotion of a prompt version on evals without blocking every small copy change?

Worked answer from AI-Engineer-Interview-Questions by Om (MIT), reformatted for LLM Prep · answer text last updated 6 November 2026 · scoring and review schedule by LLM Prep