TOOL WIKI · OBSERVABILITY

OpenInference

Provides instrumentation and semantic conventions for tracing AI applications.

Download example files Code + setup + checks in a ZIP
Jump to a section 10 sections

EXAMPLE USE CASE

Label a tool span using shared AI trace semantics

A developer needs evidence of what ran, which child operation failed, and how to turn that failure into a reproducible test.

Input
A synthetic tool input/output and OpenInference span attributes.
Expected output
An exported TOOL span with structured input/output fields.
  • Success check: The exported span carries OpenInference tool, input and output semantic attributes.
  • Try a failure: Redact real identifiers before using these payload fields in a shared tracing backend.

Example scope: Actual local semantic-convention export, not automatic capture of an entire agent run.

Official reference · OpenInference

WHAT IT ISAI instrumentation conventions
WHERE IT FITSObservability
SEE HOW THE SYSTEM FITS TOGETHERSELECT A COMPONENT
inputprocessresultcheckoutputAgent runOne trace identityInstrumentationRedacted spans + eventsOpenInferenceAI instrumentation conventionsInvestigationFollow a failed taskRegression datasetConfirmed failuresOperational decisionFix, release, or alert
  1. Propagate a trace identifier through models, retrieval, and tools.

  2. Capture meaningful timings and outcomes while excluding unnecessary content.

  3. Standardizing the shape of model, tool, and retrieval spans. Keep application-level outcomes visible alongside low-level spans.

  4. Join parent-child spans and compare observed results with task expectations.

  5. Turn verified failures into repeatable evaluation cases.

  6. Use task success, error rates, latency, and cost to decide what to change.

    Result or stopping point
OpenInference

Standardizing the shape of model, tool, and retrieval spans. Keep application-level outcomes visible alongside low-level spans.

Follow the arrows, then select a component to inspect its responsibility. On mobile, downward arrows connect the next step; bent arrows identify branches and return paths. Select a destination to jump to that component.

When to consider it

  • Standardizing the shape of model, tool, and retrieval spans.

A design decision to make

  • Keep application-level outcomes visible alongside low-level spans.

Prerequisites and setup

  • Python 3.11+. Only synthetic IDs/statuses are recorded; the exporter prints locally.
Shell
python3 -m venv .venv
source .venv/bin/activate
pip install opentelemetry-sdk openinference-semantic-conventions

Try a small integration

trace.py

Python · trace.py
import json
from opentelemetry import trace
from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.sdk.trace.export import SimpleSpanProcessor, ConsoleSpanExporter
from openinference.semconv.trace import SpanAttributes, OpenInferenceSpanKindValues

provider = TracerProvider()
provider.add_span_processor(SimpleSpanProcessor(ConsoleSpanExporter()))
trace.set_tracer_provider(provider)
with trace.get_tracer("asg-demo").start_as_current_span("lookup-order") as span:
    span.set_attribute(SpanAttributes.OPENINFERENCE_SPAN_KIND,OpenInferenceSpanKindValues.TOOL.value)
    span.set_attribute(SpanAttributes.INPUT_VALUE,json.dumps({"order_id":"A104"}))
    span.set_attribute(SpanAttributes.OUTPUT_VALUE,json.dumps({"status":"packed"}))
provider.shutdown()

Run and check the result

Shell
python trace.py
  • The exported span carries OpenInference tool, input and output semantic attributes.
  • No model is invoked. Use the matching SDK instrumentor when replacing manual spans with automatic framework capture.

Common failures

  • No trace: check the project/region, credentials, collector protocol and exporter flush before changing instrumentation.
  • Avoid double instrumentation that produces duplicate model spans or conflicting trace providers.

Production decisions

  • Redact keys, private prompts, personal data and sensitive tool results before exporting telemetry. Configure sampling and retention.
  • Connect request, agent, model and tool spans with parent/child trace context. A successful span is not a quality or authorization verdict.

Keep exploring

An evaluation gate for agent releasesThe real cost of an agent run

Explore the same layer

LangfuseLangSmithArize PhoenixOpenTelemetry

Compare candidates on your own workload. This entry describes a product’s role; it is not a claim that products in the category are interchangeable.