Lab 02 of 09OpenTelemetry GenAI trace viewer

Watching an Agent Think

Run an AI agent against flaky tools and see every span, retry and idempotent replay drawn as it happens.

  • OpenTelemetry GenAI
  • Idempotency keys
  • AI agents
Task
Chaos
trace — status idle

    Pick a task and press Run agent. A run starts by itself in a moment.

    Duration
    0 ms
    Tokens in
    0
    Tokens out
    0
    Tool calls
    0
    Retries
    0
    Duplicated side effects
    0

    Built by Melih Kızmaz · runs entirely in your browser

    What you are looking at

    Each run is a simulated AI agent, drawn the way Jaeger or Grafana Tempo would draw it: oneinvoke_agent root span, chat spans for each model call (withgen_ai.usage.input_tokens and output_tokens), andexecute_tool spans for every MCP tools/call. The attribute names follow the OpenTelemetry GenAI semantic conventions, which are still in Development status. That is why Melih Kızmaz recommends emitting them from one mapping file behind your own facade, so a rename costs a diff, not a migration.

    Why the retry matters

    Turn on Flaky network and a tool call loses its response stream after the server has already done the work. The client times out and has to send the call again with a new request id. Logs can't tie the two attempts together. In the trace they sit next to each other as siblings under the same parent.

    With Idempotency keys on, both attempts carry the same idempotency_key, so the server replays the first result in about 2 ms and the refund happens once. Turn keys off and the retry looks like a new request, so the customer gets refunded twice. Read-only tools never carry a key: retrying a read costs latency, not correctness. The contract side of this is covered inDesigning MCP tool contracts that survive a retry.

    Honest scope: the tasks, timings and token counts are scripted and run entirely in your browser. No model is called and nothing is sent anywhere. The span shape, the overlap of the two attempts and the replay behaviour come from the real traces in the articles.

    Read the long versionInstrumenting agents with OpenTelemetry GenAI in Node.jsNaylaLabs