TOOL WIKI · OBSERVABILITY
OpenInference
Provides instrumentation and semantic conventions for tracing AI applications.
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
Propagate a trace identifier through models, retrieval, and tools.
Capture meaningful timings and outcomes while excluding unnecessary content.
processTo 03 · OpenInferenceStandardizing the shape of model, tool, and retrieval spans. Keep application-level outcomes visible alongside low-level spans.
resultTo 04 · InvestigationJoin parent-child spans and compare observed results with task expectations.
Turn verified failures into repeatable evaluation cases.
Use task success, error rates, latency, and cost to decide what to change.
Result or stopping point
Standardizing the shape of model, tool, and retrieval spans. Keep application-level outcomes visible alongside low-level spans.
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.
python3 -m venv .venv
source .venv/bin/activate
pip install opentelemetry-sdk openinference-semantic-conventionsTry a small integration
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
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
Explore the same layer
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.