An AI feature that worked in testing produced a wrong answer for one user in production, and there was no way to reconstruct what actually happened — what prompt was sent, what came back, which model version answered.
Log these, structured, on every call
- The exact prompt sent (or a hash plus the template version, if the prompt contains sensitive data).
- Model name and version, temperature and other parameters used.
- Full raw response, latency, and token counts in and out.
- A request ID that threads through your whole system, so one user's report maps to one trace.
Trace, don't just log
A single user action often triggers several LLM calls (retrieval, generation, a safety check). Group them under one trace ID so you can see the whole chain, not disconnected log lines.
See RAG observability: what to log for the retrieval-specific version of this.






