An agent is a black box unless observed

Auto-research and self-improvement pipelines run with many LLM calls and tool executions intertwined. Without seeing which step was slow, which tool failed, or why a decision was made, neither improvement nor debugging is possible. Observability is a precondition of operations, not an add-on.

OpenTelemetry's GenAI semantic conventions solve this as a standard. They define prompts, model responses, token usage, and tool/agent calls as common span attributes, so a span from a LangChain agent looks identical to one from a raw OpenAI call.

The span-tree structure

A trace reveals a span tree. Under a top-level invoke_agent span, a chat child span attaches for each LLM call and an execute_tool span for each tool execution. Span names follow the execute_tool {tool name} rule, and token usage and provider metadata are recorded as standard attributes. Conventions for MCP tool calls were also added recently.

Full guide: from planning to operations

In planning, define observation goals as numbers. For example, set trace coverage of 95% or higher, a span-loss rate of 1% or lower, and per-stage p95 latency ceilings. Adopting the standard conventions from the start avoids vendor lock-in. Backends like Datadog, Honeycomb, and New Relic already support these conventions, and LangChain, CrewAI, and AutoGen emit OTel-compatible spans natively or via instrumentation, so following the standard preserves observability even when you switch tools.

Failure patterns usually come from broken spans and missing context propagation. If trace context breaks at a tool call or async task, the parent-child relationship breaks and cause tracing gets hard. To prevent this, apply context propagation consistently across tool and queue boundaries, and keep a request ID and step identifier on each span. For recovery, if the span-loss rate exceeds a threshold, treat it as an instrumentation regression and block deployment at the gate. When keeping prompts and responses on spans, mask sensitive data or store references only.

On the operations checklist, include consistency of standard attributes. Fill tool name, token usage, model name, latency, and error code per convention, and keep reasoning steps as structured events for post-hoc analysis. As observability fields, record trace coverage, span error rate, per-tool latency distribution, and token-cost attribution.

The continuous improvement loop analyzes top-latency spans and top-error tools weekly. Improve steps with recurring bottlenecks via cache or routing, and fix contracts for frequently failing tools. Tracing should be a system that keeps expanding to fill observation gaps, not instrumentation installed once and finished.

Key takeaways

In short, an agent is a black box without standard tracing. Standardize invoke_agent, chat, and execute_tool spans with OTel GenAI conventions, and carry context propagation across tool and queue boundaries. Observe trace coverage and span error rate and keep improving bottlenecks to see an automatic loop's performance and causes transparently.

References

OpenTelemetry GenAI Semantic Conventions