A single user request to an agent might fan out into a dozen LLM calls: retrieval, tool calls, sub-agent loops. When something goes wrong, you need LLM traces to follow that whole journey. Here's how tracing works and why it's the backbone of agent observability.

From request to trace

A plain request ledger logs each individual LLM call. A trace groups many calls that belong to one logical operation - a RAG pipeline, an agent loop, a multi-step workflow. The key is a trace ID:

# Send a trace ID with each related request

headers = {

    "X-Trace-Id": "trace_9f3a21",

    "X-Property-agent": "research-copilot",   # custom property

}



# Every request carrying this ID is grouped into one trace

Infere's Observability platform uses X-Trace-Id headers to group requests into traces, and X-Property-* headers to tag them by feature, tenant, or environment.

What a good trace shows you

  • Order - which calls happened, and the parent/child relationship.
  • Duration - total trace time and per-call latency, so the slow step stands out.
  • Cost - total cost across all the calls in the workflow.
  • Errors - which step failed, and whether retries kicked in.
  • Path - tool calls, model hops, and branch points.

Debugging an agent with traces

Imagine a user reports that a research agent took 40 seconds and returned a partial answer. Without traces, you'd guess. With traces, you immediately see: the agent called a slow model, then hit a rate limit, retried, and finally returned a degraded answer. You trace it to the exact step, model, and request - then fix the prompt or routing for that step.

Trace-level observability turns "it was slow" into "this specific retrieval step added 12 seconds and cost $0.08." That's the difference between debugging and guessing.

Tracing for RAG and agents

For RAG pipelines, group the embedding lookup, the retrieval calls, and the generation into one trace. For agents, group the initial turn and every tool-call loop iteration. The pattern is the same: propagate one trace ID through the whole flow and log it at each step.

LLM traces turn a black-box agent into a sequence you can inspect, measure, and fix.

Next steps

Infere groups requests into LLM traces automatically from trace IDs and custom properties, and pairs tracing with cost analytics and evaluation. Start tracing your agent workflows and you'll stop debugging blind.

Tracing also reveals where cost accumulates across multi-step calls - read the true cost of agentic coding to understand the token economics behind the workflows you trace. Our LLM observability guide covers the full telemetry stack that makes tracing possible.

Trace every agent step

Group multi-step LLM workflows and understand cost, latency, and errors.

Start Free → See Observability