TemplatesGet a demo →Book a meeting
Blog
GovernanceTechnical

LLM Observability: What to Log for Every Model Call and Agent Run

In short

LLM observability is the practice of recording what happens in every model call and agent run: the prompt, the retrieved context, the model, tokens, latency, cost and evaluation scores, plus each agent step, tool call, approval and write. Engineering uses it to debug, risk teams use it as evidence, and finance uses it to attribute spend.

Key takeaways

  • LLM observability records the prompt, retrieved context, model, tokens, latency, cost and quality score for every model call.
  • For agents it adds every step, tool call, approval decision and write made to another system, joined to the run.
  • Developer observability helps engineers debug; governance-grade audit has to be complete, tamper-evident and verifiable by someone who does not trust the vendor.
  • The same records serve three audiences: engineering, risk and compliance, and finance.
  • Logs must be safe to keep, so personal data and secrets should be masked or redacted before they are written.

LLM observability is the practice of recording what happens in every model call and agent run, so a team can explain, debug and prove what an AI system did. For a model call that means the prompt, the retrieved context and its sources, the model, tokens, latency, cost and a quality score; for an agent it adds every step, tool call, approval and write made to another system.

Traditional application monitoring tells you a request took 900 milliseconds and returned 200. That is not enough for an AI system, where the request "succeeded" and the answer still cited last year's travel policy. The failure lives in the content: what the model was shown, which version of which document it retrieved, and what it did with it. LLM observability exists to make that content inspectable.

What is LLM observability?

LLM observability covers three layers of record:

  • The call. One request to one model: input, context, output, model, tokens, latency, cost.
  • The answer. What the user saw, which sources it cited, and how it scored on grounding or evaluation checks.
  • The run. For agents, the sequence of steps that produced an outcome, including tools called, policies applied, approvals given and writes made.

LLM monitoring is the aggregate view over those records: latency percentiles, error rates, token volume, cost by team, pass rates over time. Monitoring tells you something moved. Observability lets you open one run and find out why.

What to log for every model call

At minimum, each model call should carry:

  1. Who and where. The user or service identity, the surface (chat, agent, API, form) and the deployment.
  2. Input. The prompt as sent, after masking, and the system instructions version.
  3. Retrieved context. The passages included and the document, version and passage each came from.
  4. Model. Provider, model name and any routing or fallback decision.
  5. Usage. Tokens in and out, latency and cost.
  6. Output. The response as delivered, with its citations.
  7. Checks. Guardrail results: injection detected or not, PII masked, grounding score, whether the answer was blocked or routed to a person.

The context is the item teams most often skip, and it is the one that explains most bad answers. A wrong answer with the right sources is a model problem. A wrong answer built on a superseded document is a data problem. Without the retrieved context in the record, you cannot tell which one you have.

What to log for every AI agent run

Agent observability is call observability plus the run. Each run should record:

  • the trigger (a person, a schedule, an event or a file) and who it ran as;
  • every step, in order, with its input, output and duration;
  • each tool call with arguments and result;
  • each policy decision on an action: run, hold for a person, or refuse;
  • each approval, with the approver, time and context;
  • each write to another system, with what it did (create, update, close, send) and where it landed.

Joined to one run identifier, those records turn "what did this agent change in Jira and the CRM last Tuesday?" into a query. How writes are made exactly once and recorded is covered in AI agent governance; how multi-step runs are coordinated is in AI orchestration.

AI agent observability: three runs worth replaying

The value of a good record shows up in specific incidents. Here are three illustrative ones, of the kind every team running agents eventually meets:

The duplicate ticket. A triage agent timed out talking to the helpdesk, retried, and a customer received two replies. The run record shows the first call succeeded after the timeout fired. The fix is not in the prompt; it is idempotent execution keyed to the step. Without the per-step record, the team would have blamed the model.

The confident wrong policy. An HR assistant told a manager that international travel needs no pre-approval. The answer cited a document, and the record showed which one: version 3 of the travel policy, superseded by version 4 two months earlier. The model behaved correctly on bad context. The fix was retiring the old version at the source and checking the connector's deletion handling.

The approval nobody remembers. An auditor asked who approved a supplier-record change in March. The run held the write for approval, the approver's decision was recorded with time and context, and the change itself was joined back to the run. The answer took a query, not a week of email archaeology.

Each story needed a different signal: per-step timing, retrieved-source versions, and the approval record. That is why agent observability has to capture the whole run, not just the model calls inside it.

LLM observability signals and who uses them

Signal Why it matters Who uses it
Prompt and system instruction version Explains behavior changes after an edit Engineering
Retrieved passages and source versions Separates data problems from model problems Engineering, knowledge owners
Model, provider and routing decision Shows which provider saw which data Engineering, risk
Tokens, latency (p50/p95) Capacity planning, user experience Engineering
Cost per call, run, agent and team Attribution, budgets and chargeback Finance
Guardrail events (injection, PII, secrets) Evidence that controls fired Risk and security
Grounding and evaluation scores Quality over time; release gating Engineering, product owners
Agent steps and tool calls Debugging failed or slow runs Engineering
Approvals and policy decisions Proof a person decided where policy required Risk, compliance, auditors
Writes to other systems What the AI actually changed Risk, system owners
Refused and failed runs Abuse, misconfiguration and limits Security, engineering

Developer observability vs. governance-grade audit

Engineering traces and audit evidence overlap in content and differ in purpose.

Developer observability is for debugging. It can be sampled, and engineers can filter, edit or delete it. It sits in the tool the engineering team prefers, and that is fine for its job.

Governance-grade audit is evidence. It has to be complete for material events, append-only, and verifiable by someone who does not trust whoever wrote it. That last property is the one most systems lack. The test is not "do you log everything?" but "can an auditor confirm a record was not changed without asking you?"

Why it matters

A trace helps your engineers understand a failure. An audit record has to convince someone who assumes you are wrong. Build for the second, and the first comes almost for free.

The full argument for verifiable records, including signed receipts and tamper-evident exports, is in AI audit trail compliance.

Where OpenTelemetry fits

OpenTelemetry now maintains semantic conventions for generative AI: standard names for spans, metrics and events emitted by GenAI clients, with related conventions for MCP and individual model providers. Adopting them lets AI traces sit beside the rest of your application telemetry and keeps you portable across tracing back ends.

Use them for the engineering layer. They standardize how signals are named; they do not decide what must be kept, who may change it, or how a third party verifies it. Those are governance questions.

Logs must be safe to keep

An observability store full of raw prompts is a second copy of your most sensitive data. Two rules keep it usable:

  • Mask before you write. Personal data in prompts and answers should be masked by policy in the request path, before it reaches the model or the log.
  • Never store secrets. Keys and tokens pasted into a message should be caught and redacted, so the record notes that a secret was present without holding its value.

If the log is not safe to keep, it gets purged early, and then it is not there when the auditor asks.

How SphereIQ records model calls and agent runs

In SphereIQ, observability and audit come from the same request path, because every call passes through the Governance plane:

  • Every model call is written to the audit log with who made it, the model, the tokens in and out, and what it cost. Administrative actions go to the same log, and the application only ever adds to it.
  • Guardrails (prompt-injection detection, secret scanning and personal-data masking) run on every chat message before it reaches a model, and their events land on the same ledger as retrievals, policy hits, governed actions and agent publishes.
  • Agent runs in the AI Factory are recorded step by step. Scheduled and event runs land in an Output queue with assignment, review state, feedback and cost.
  • Evaluations report pass rate, p50 and p95 latency and cost per run, and retrieval is scored separately by citation hit-rate against ground-truth answers.
  • Cost is attributed per feature, per user and per session, with chargeback exports by user, team or department.
  • Published agents record every run, refusals included, with the surface, the input, the outcome and the cost.
  • Evidence is verifiable. Receipts are Ed25519 signatures over canonical JSON with a published public key, and administrators can export records as newline-delimited JSON with a SHA-256 manifest anyone can check offline.

The security page lists these controls as built, including what is not built yet.

How to set up LLM observability in five steps

  1. Pick one run identifier and make every call, retrieval, tool call, approval and write carry it.
  2. Record context, not just text. Store the source document, version and passage for every retrieved chunk.
  3. Mask and redact at the edge so the log is safe to retain for as long as your auditors need.
  4. Attach quality signals. Add grounding checks to live traffic and a gating evaluation set to every release; the scoring method in how to score a RAG answer is a practical start.
  5. Separate the debugging view from the evidence store. Engineers get searchable traces; risk gets an append-only, verifiable record.

Then test it: pick a bad answer from last week and see how long it takes to explain it. If it takes an afternoon, the record is missing something. The controls that should have stopped the bad answer are covered in AI guardrails, and the 15 enterprise AI agent use cases show which runs will need the deepest records first.

Frequently asked questions

What is LLM observability?
LLM observability is the practice of capturing enough about each model call and agent run to explain what happened: the input, the retrieved context and its sources, the model used, token counts, latency, cost, quality or evaluation scores, and for agents the steps, tool calls, approvals and writes. It lets teams debug failures, prove behavior to auditors and attribute spend.
What is the difference between LLM observability and LLM monitoring?
Monitoring watches known indicators over time, such as error rates, latency percentiles, token volume and cost, and alerts when they move. Observability keeps enough detail on each individual call or run to answer questions you did not plan for, such as why one answer cited the wrong policy. Monitoring tells you something changed; observability lets you find out why.
What should you log for an AI agent run?
Log the trigger and the user or system that started the run, every step with its input and output, each model call with model, tokens, latency and cost, each retrieval with the sources returned, every tool call with its arguments and result, policy decisions and approvals with the approver and time, and every write to another system. Join all of it to one run identifier.
Is an observability tool enough for AI audit and compliance?
Usually not on its own. Developer tracing tools are built for debugging, often sample data, and can be edited or purged by the team that owns them. Audit evidence must be complete for material events, append-only, and verifiable by a third party, for example through signed records and exports with a hash the recipient can recompute. Many enterprises need both layers.
Does OpenTelemetry support LLM observability?
Yes. OpenTelemetry maintains semantic conventions for generative AI covering spans, metrics and events for GenAI clients, with related conventions for MCP and specific model providers. Using them lets AI traces sit alongside your existing application telemetry. They standardize how engineering signals are named; they do not by themselves create audit-grade evidence or approval records.

Trace one agent run from request to write.

In a walkthrough we run an agent on one of your sources and open its record: every step, model call, retrieval, approval and write, plus the signed export an auditor would receive.