# AI Observability

> The AI Observability is the practice of tracing, logging and monitoring the behavior of AI applications in production.

## What is LLM observability and what should I log?

The practice of recording every model call, prompt, tool call, token count, latency and cost as traces. Helps debug agents, find failing cases, control spending and turn real problems into eval cases.

- Topic: Quality & Operations
- Type: practice

## Example

Wrong:

```js
const res = await llm(messages);
console.log('LLM call', messages, res.text);
```

Right:

```js
const start = Date.now();
const res = await llm(messages);
logger.info('llm_call', {
  model: res.model,
  inputTokens: res.usage.input_tokens,
  outputTokens: res.usage.output_tokens,
  latencyMs: Date.now() - start,
  prompt: redact(messages),
});
```

Structured logs with model, tokens and latency make calls searchable, and redaction keeps personal data out of stored prompts.

## Common mistakes

- Logging full prompts with user data into a third-party tool without consent or redaction.

## Key points

- Each request logs the model, token counts, latency, cost and errors.
- Agent runs are traced as a tree of steps, including every tool call and its result.
- Secrets and personal data are redacted before prompts and outputs are stored.

## Interview questions

### What is the difference between AI observability and regular monitoring?

Regular monitoring tracks uptime and errors. AI observability also records prompts, outputs, tool calls, tokens and cost, so you can see why a model behaved a certain way.

### What is a trace in LLM observability?

A trace is the record of one request as a tree of steps, such as model calls, retrieval and tool calls, with their inputs, outputs and timing.

### Is it safe to log full prompts?

Only after redacting secrets and personal data, and with user consent where required. Limit who can read the logs and how long they are kept.

## Related cards

- [LLMOps](https://wonderium.dev/ai/llmops.md)
- [Evals](https://wonderium.dev/ai/evals.md)
- [Token Cost](https://wonderium.dev/ai/token-cost.md)
- [Latency](https://wonderium.dev/ai/latency.md)
- [AI Gateway](https://wonderium.dev/ai/ai-gateway.md)

---

- Level: [Artificial Intelligence](https://wonderium.dev/ai.md)
- HTML version: https://wonderium.dev/ai/ai-observability
- Last updated: 2026-11-25
