Back to feed
Dev.to
Dev.to
7/18/2026
How I Traced My AI Agent's Decision Loop With OpenTelemetry and Signoz (and Caught It Calling the Same Tool Twice)

How I Traced My AI Agent's Decision Loop With OpenTelemetry and Signoz (and Caught It Calling the Same Tool Twice)

Short summary

The author traces a ReAct-style AI agent's full decision loop using OpenTelemetry and SigNoz, going beyond auto-instrumentation to add manual spans for LLM calls and tool calls. Within 30 minutes they identified a query taking 4 iterations because the model called the calculator with identical input three times, and another where malformed action shapes caused two wasted attempts. The article includes setup commands, common pitfalls (PEP 668, wrong model names, ThinkingBlock handling), and practical span attributes for diagnosis.

  • Manual OpenTelemetry spans on agent decision logic reveal issues invisible in JSON responses
  • Caught the model calling the calculator with identical input 3 times — correct answer but wasted iterations
  • Includes setup commands, common pitfalls, and span attribute patterns for agent debugging

Generated with AI, which can make mistakes.

Is this a good recommendation for you?

Comments

Failed to load comments. Please try again.

Explore more