Why Observe AI
Traditional software fails loudly β an exception, a 500, a crashed pod. AI features fail quietly, and that difference is the whole reason this module exists. You cannot fix what you never see, and with a language model the breakage is usually invisible.

Failures are silent
When a model returns a wrong answer, it looks exactly like a right one. Same shape, same confident tone, same HTTP 200. There is no stack trace, no red log line, no alert. A grounded Q&A feature that has quietly started citing the wrong document, or a summarizer that drifted into hallucination after a prompt tweak, will keep serving users for weeks unless something is watching the content of its behavior β not just whether the call succeeded.
This is why standard uptime monitoring is necessary but nowhere near sufficient. Your dashboards can be all green while the actual quality of answers has quietly collapsed.
You cannot improve what you do not measure
The flip side of silent failure is silent un-improvement. If you don't record what the AI did, you have no dataset to learn from:
- You can't tell which feature burns the most tokens.
- You can't see that one provider's p95 latency doubled last Tuesday.
- You can't prove a prompt change made answers better β or worse.
- You can't spot that the system started refusing twice as often.
Observability turns the AI from a black box you hope is working into an instrumented component you can reason about, tune, and trust.
Observability is a feature, not an afterthought
In LyraLearn, every AI call β the RAG tutor, the quiz generator, the lesson summarizer β is instrumented at the call site, not bolted on later. Three layers work together:
- Serilog captures structured logs: one event per call, with properties you can query rather than grep.
- OpenTelemetry emits traces, so a single
traceIdties the user request to the embedding lookup, the retrieval, and the model call. - The evaluation record (the next lesson's
ops.AiEvaluationstable) persists one durable row per call for long-term analysis.
Together these answer the question that uptime monitoring cannot: was the answer any good, and is it getting better or worse over time? For a probabilistic component living inside a production system, that question is the one that matters β and observability is the only way to ever answer it.