The Four Streams: Traces, Metrics, Logs, and Evaluations for Production Agent Observability

Collect traces, metrics, logs, and evaluations together so a green dashboard no longer hides wrong agent answers or runaway cost.

Mapki

Mapki

Nov 20, 2026•6 min read
Share:
Mapki
Custom Agents

Why a Green Dashboard Still Hides Wrong Answers

Agents decide what to do between one model call and the next. A latency chart that stays flat and an error rate that stays near zero can still hide a tool that is called with the wrong arguments, a retrieval that returns the wrong document, or a final answer that ignores the evidence the agent just fetched. Observability for agents therefore needs more than the three classical pillars. It needs four complementary streams that together answer what the agent did, how expensive and slow it was, what discrete events occurred, and whether the outcome was actually good.

This post lays out a practical pattern drawn from production practice in late 2026: hierarchical traces, operational metrics, structured logs, and attached evaluations. The goal is a system you can instrument in a week and that continues to surface silent failures weeks later.

The Four Streams

  • Traces: The ordered graph of what happened. One root span for the agent run, child spans for every model call, tool invocation, retrieval, and memory read or write. Attributes follow OpenTelemetry GenAI semantic conventions (gen_ai.operation.name, gen_ai.request.model, gen_ai.usage.input_tokens, tool name, etc.) so the same tree is readable in any backend.
  • Metrics: Aggregated numbers that move before users complain: cost per successful run, steps or tool calls per run, retry rate, tool-error rate by tool, p95 latency per step, and cache-hit rate. These are the early signals of loops, drift, or prompt regressions.
  • Logs: Timestamped, immutable records of discrete events that do not fit cleanly into spans—approval decisions, policy violations, human overrides, state transitions, and explicit side-effect confirmations. Keep them structured and correlated by the same trace ID.
  • Evaluations: Quality scores attached to the same traces. Mix deterministic checks (schema validity, tool-result usage, outcome probes against real system state) with sampled LLM judges on the failure modes you already care about. A run that returns 200 and still scores 2/5 on groundedness is a failure.

Any one stream alone leaves a blind spot. Traces without scores tell you the path but not whether it was correct. Scores without traces leave you guessing which span caused the drop. Metrics without either surface the symptom but not the cause.

Week-One Instrumentation Checklist

  1. Instrument one high-value agent end-to-end so every model call, tool call, and retrieval appears as a child span under a single agent span. Prefer framework autologging or OpenTelemetry exporters that emit GenAI semantic conventions; fall back to explicit decorators only where necessary.
  2. Capture token counts, model version, prompt version or hash, and tool schema version on every span. Store the full prompt and completion only when sampling and redaction rules allow; default to redacted or sampled content for PII.
  3. Emit the core metrics at p50/p95 and as distributions: tokens in/out, cost, step count, tool-call count, end-to-end latency, and success (defined by your outcome check, not by HTTP 200).
  4. Add a lightweight evaluation gate: at least one deterministic outcome probe per action type that writes external state (re-read the calendar event, re-fetch the CRM record, compare the deployed SHA). Sample 5–10 % of production runs for a small set of LLM judges focused on your top three failure modes.
  5. Alert on behavior, not only errors: rising cost per success, increasing steps per run, tool-error spikes, or eval-score drops relative to a rolling baseline.

A practical starting sequence used by several teams: week one traces, week two cost and latency baselines, week three sampled evaluations tied to known failure modes.

What to Capture on Every Span

Keep the attribute set small and consistent so cardinality stays manageable:

  • gen_ai.operation.name (chat, invoke_agent, execute_tool, …)
  • gen_ai.provider.name and gen_ai.request.model / gen_ai.response.model
  • Token usage (gen_ai.usage.input_tokens, gen_ai.usage.output_tokens) and, when available, cached tokens
  • Tool name and a hash or stable ID of the arguments (full arguments only when safe)
  • Trace and parent-span IDs so the tree reconstructs correctly across process or service boundaries
  • Business context that does not explode cardinality: tenant, workflow name, risk tier

Message content itself is opt-in under the current OpenTelemetry GenAI conventions. Capture it only behind explicit sampling and redaction.

Connecting Evaluations to Traces

The highest-leverage step is writing the quality score back onto the same trace. Once a run carries both its execution tree and a score (or a set of criterion-level pass/fail results), three things become possible:

  • You can filter the trace UI to “score < 3 and cost > $0.40” and immediately see the failing paths.
  • Failures turn into regression test cases within days instead of remaining one-off tickets.
  • Drift becomes visible as a slow downward slope in the score distribution long before the error rate moves.

Outcome probes are especially valuable. A tool span that returns success does not prove the world changed correctly. After a refund is issued, re-read the order and confirm the amount and status; after a meeting is booked, re-read the calendar and confirm the attendees and time. Log the probe result as a separate evaluation attribute on the trace.

Sampling, Redaction, and Cost Control

Full content on every production run is rarely affordable and rarely safe. Practical defaults used in production:

  • Always record structural telemetry (spans, token counts, tool names, error flags).
  • Sample full prompt/completion content at 1–5 % for debugging and at higher rates on error or low-score runs.
  • Redact or hash known PII fields before storage; never store raw credentials or full payment data.
  • Enforce hard pre-call budgets (tokens, steps, wall-clock) so a looping agent cannot generate unbounded telemetry of its own failure.

Common Failure Patterns Visible Only in the Trace Tree

  • Repeated identical tool calls → missing step limit or unclear tool description.
  • Tool error followed by retries that never surface to the user → silent degradation.
  • Correct tool output followed by a final answer that ignores it → model misuse of the result; inspect the next model span’s input.
  • Long gap with no child spans → work happening outside any traced code.
  • Sudden rise in steps or tokens after a prompt or model change → regression that metrics will catch before users do.

Reading one failing trace next to one successful trace of the same input usually reveals the first divergent span.

References & Community Insights

The four streams do not replace careful design of the agent itself. They make the remaining failures visible, attributable, and convertible into the next test case before they reach users or the finance team.

Want to implement this in your business?

Mapki designs bespoke AI agents, custom workflow automations, and tool-agnostic integrations tailored specifically to your existing ERP, CRM, and databases.

Tags:Agent ObservabilityTracingOpenTelemetryAI AgentsProduction AgentsEvaluations