LLMOps: Tracing, Prompt Versioning, Eval Gates and Incidents
LLMOps for production AI: tracing model and tool calls, versioning prompts and configs, eval gates in CI, canary releases, feedback and incident response.
LLMOps is the operational discipline for LLM applications: tracing every model and tool call, versioning prompts, models and retrieval configs together, gating releases on evals, rolling out behind canaries, collecting feedback, and handling incidents when quality, safety or cost goes wrong. It extends MLOps and ordinary observability with the fact that an LLM app's behaviour lives in prompts and configuration as much as in code.
What to version
A response is produced by a combination of artifacts; changing any one can change behaviour. Treat the combination as a release:
| Artifact | Example | Why it matters |
|---|---|---|
| Prompt templates | support_answer v14 | Wording changes shift behaviour on unseen cases |
| Model and parameters | provider/model version, temperature 0.2 | Model upgrades change outputs even with the same prompt |
| Retrieval config | Embedding model, chunking v3, top-k 8, reranker v2 | Changes what context the model sees |
| Tool definitions | issue_refund schema v5 | Descriptions steer tool use |
| Guardrail policies | Moderation thresholds, PII rules | Change what's blocked |
| Eval suite | golden_v6 | Defines what "passing" meant for this release |
Store these in version control or a config registry, deploy them through the same review and CI process as code, and stamp every trace with the versions used.
Tracing
- One trace per user request, with child spans for each guard, retrieval, model call and tool call.
- Record per span: inputs and outputs (redacted), model, versions, token counts, cached tokens, cost, latency, errors.
- Propagate trace ids across services and agents; OpenTelemetry has semantic conventions for generative AI spans.
- Respect privacy: redact PII before storage, restrict access, set retention limits.
Metrics and dashboards
| Category | Metrics |
|---|---|
| Latency | Time to first token, total latency p50/p95/p99, per-span latency |
| Reliability | Error and timeout rates per provider and model, fallback rate, schema repair rate |
| Cost | Tokens and cost per request and per resolved task, cache hit rates, top expensive tasks |
| Quality (online) | Thumbs-down rate, regeneration rate, escalation to human, sampled judge scores for groundedness |
| Safety | Guardrail block rates by category, injection detections, policy violations found in review |
| Agents | Steps per task, budget-exhausted rate, tool error rates, repeated-action loops |
Releasing changes safely
- Use feature flags or gateway routing to switch prompt and model versions without redeploying.
- Define abort thresholds in advance: error rate, cost per task, thumbs-down rate, block rate.
- Pin model versions; when a provider deprecates one, run the full suite on the replacement before switching.
Feedback loops
- Collect explicit feedback (thumbs, comments) and implicit signals (copy, retry, rephrase, escalate).
- Sample traces daily for human or judge review, oversampling negative feedback and unusual patterns.
- Turn confirmed failures into eval cases, and recurring failure types into prompt, retrieval or tool fixes.
- See LLM evaluation.
Incident response
- Detect: alerts on quality, safety, cost or latency metrics, or user reports.
- Mitigate: roll back to the last good version set, switch provider, tighten a guardrail, or disable the feature with a flag.
- Preserve evidence: keep the traces and version stamps of affected requests.
- Reproduce with the exact versions and inputs; LLM behaviour varies, so run the case many times.
- Fix and prevent: add the cases to the eval suite, add a check or control, and release behind a canary.
- Review: a blameless post-incident review, as for any outage; see incident management.
Where it’s used
Tracing and canaries catch regressions from prompt edits before most users see them.
Step-level traces make loops, tool errors and cost spikes debuggable.
Versioned configurations and retained traces provide an audit trail of what the system did and why.
In an interview
- Version prompts, models, retrieval and tools together and stamp traces with them.
- Trace each request with spans for guards, retrieval, model and tool calls.
- Gate releases on evals, canary with abort thresholds, and roll back by config.
- Describe an incident runbook for a bad prompt or model change.
Frequently asked questions
What is LLMOps?
The operational practice for LLM applications: tracing model and tool calls, versioning prompts, models and retrieval configs together, gating releases on evaluations, canary rollouts, feedback collection and incident response.
What should you monitor in an LLM application?
Time to first token and total latency, error and fallback rates, tokens and cost per task, cache hit rates, online quality signals such as thumbs-down and escalations, guardrail block rates, and agent steps per task.
Further reading
- Semantic conventions for generative AI systemsOpenTelemetry
- AI Engineering: Building Applications with Foundation ModelsChip Huyen, O'Reilly