LLM observability & tracing
Record every model and tool call so you can debug behaviour, track cost and turn failures into tests.
Normal monitoring tells you a request was slow. For AI features you also need to know what the model saw and said. Record a trace per request with a span for each model call, retrieval and tool call, and attach the prompt version, the model and parameters, token counts, latency and the outcome.
Capture enough to replay a failure: the exact inputs, retrieved context and tool results. Redact personal data before it is stored, set retention limits, and restrict who can read traces, since they contain user content. Sample routine traffic and keep every error and every thumbs-down.
Turn the data into decisions. Track cost and latency per feature and per model, quality signals such as refusal rate and user feedback, and drift after a prompt or model change. The loop that matters most is sending bad traces into your eval set so the same failure cannot return unnoticed.
Key points
- One trace per request with spans for every model, retrieval and tool call.
- Store prompt version, model, parameters, tokens, latency and outcome.
- Redact personal data and limit access to traces.
- Feed failing traces back into your evals.
Answer these out loud
- 1A customer reports a wrong answer from last Tuesday. List the fields you need in the trace to reproduce it.
- 2What would you alert on for an AI feature, beyond error rate and latency?
Use this from an agent
Any MCP client, including Grok, can read this lesson. See how to connect.
curl https://engineeros-delta.vercel.app/api/v1/topics/llm-observability-and-tracing