Registry /
ai-ml / openinference-instrumentation-smolagents
Install & Compatibility
Where this runs
No compatibility data collected yet for this library.
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
SmolagentsInstrumentor
✓ from openinference.instrumentation.smolagents import SmolagentsInstrumentor
✗ from openinference_instrumentation_smolagents import SmolagentsInstrumentor
Minimal setup to instrument smolagents with OpenInference and OpenTelemetry.
from openinference_instrumentation_smolagents import SmolagentsInstrumentor
from opentelemetry import trace as trace_api
from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter
from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.sdk.trace.export import SimpleSpanProcessor
import os
# Configure OpenTelemetry (example with OTLP HTTP exporter)
provider = TracerProvider()
processor = SimpleSpanProcessor(
OTLPSpanExporter(endpoint=os.environ.get("OTEL_EXPORTER_OTLP_ENDPOINT", "http://localhost:4318/v1/traces"))
)
provider.add_span_processor(processor)
trace_api.set_tracer_provider(provider)
# Instrument smolagents
SmolagentsInstrumentor().instrument()
# Now use smolagents normally - traces are automatically captured
Debug
Known issues
gotchaThe instrumentation only works with smolagents version >= 0.1.0. Older versions are not supported.fixUpgrade smolagents to >=0.1.0
affects: <0.1.0 of smolagents
deprecatedThe old import path `openinference.instrumentation.smolagents` is deprecated. Use `openinference_instrumentation_smolagents`.fixChange imports to the underscore-based package name.
affects: >=0.1.0
gotchaIf you are using multiple OpenInference instrumentors, ensure they are all instrumented before creating any spans to avoid missing context.fixCall instrument() on all instrumentors before any agent execution.
affects: all
Upgrade
Version history
0.1.32latest on PyPI · released May 22, 2026
Audit
Dependencies
openinference-instrumentationrequiredCore OpenInference instrumentation APIs
opentelemetry-apirequiredOpenTelemetry API for tracing
smolagentsrequiredInstrumentation target library