Skip to main content

OpenInference smolagents Instrumentation

pypi

Python auto-instrumentation library for LLM agents implemented with smolagents

Crews are fully OpenTelemetry-compatible and can be sent to an OpenTelemetry collector for monitoring, such as arize-phoenix.

Installation

pip install openinference-instrumentation-smolagents

Quickstart

This quickstart shows you how to instrument your LLM agent application.

You've already installed openinference-instrumentation-smolagents. Next is to install packages for smolagents, Phoenix and opentelemetry-instrument, which exports traces to it.

pip install smolagents arize-phoenix opentelemetry-sdk opentelemetry-exporter-otlp-proto-grpc opentelemetry-distro

Start Phoenix in the background as a collector, which listens on http://localhost:6006 and default gRPC port 4317. Note that Phoenix does not send data over the internet. It only operates locally on your machine.

python -m phoenix.server.main serve

Create an example like this:

from smolagents import CodeAgent, DuckDuckGoSearchTool, HfApiModel

agent = CodeAgent(tools=[DuckDuckGoSearchTool()], model=HfApiModel())

agent.run("How many seconds would it take for a leopard at full speed to run through Pont des Arts?")

Then, run it like this:

opentelemetry-instrument python example.py

Finally, browse for your trace in Phoenix at http://localhost:6006!

Manual instrumentation

opentelemetry-instrument is the Zero-code instrumentation approach for Python. It avoids explicitly importing and configuring OpenTelemetry code in your main source. Alternatively, you can copy-paste the following into your main source and run it without opentelemetry-instrument.

from opentelemetry.sdk.trace import TracerProvider

from openinference.instrumentation.smolagents import SmolagentsInstrumentor
from opentelemetry.exporter.otlp.proto.grpc.trace_exporter import OTLPSpanExporter
from opentelemetry.sdk.trace.export import SimpleSpanProcessor

otlp_exporter = OTLPSpanExporter(endpoint="http://localhost:4317", insecure=True)
trace_provider = TracerProvider()
trace_provider.add_span_processor(SimpleSpanProcessor(otlp_exporter))

SmolagentsInstrumentor().instrument(tracer_provider=trace_provider)

More Info

Metadata

Release files for openinference-instrumentation-smolagents 0.1.16

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for openinference-instrumentation-smolagents 0.1.16
File Size Uploaded Provenance Actions
openinference_instrumentation_smolagents-0.1.16.tar.gz 11.3 kB Without provenance Details for openinference_instrumentation_smolagents-0.1.16.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for openinference-instrumentation-smolagents 0.1.16
File Interpreter ABI Platform Actions
openinference_instrumentation_smolagents-0.1.16-py3-none-any.whl Python 3 none any Details for openinference_instrumentation_smolagents-0.1.16-py3-none-any.whl

Total release size: 24.3 kB

Release files / openinference_instrumentation_smolagents-0.1.16.tar.gz

Download URL openinference_instrumentation_smolagents-0.1.16.tar.gz
Size 11.3 kB
Tags Source
SHA-256 checksum
How to use checksums
71f600b38b193e9e628d1b4b52de4edae2ac8e74002b8222f88c02d1d0261df8
BLAKE2b-256 checksum
How to use checksums
3ee3f143d8cfb599ffe8a0792c86277dc9d2796a11547d5e6dfe73f2936defc3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / openinference_instrumentation_smolagents-0.1.16-py3-none-any.whl

Download URL openinference_instrumentation_smolagents-0.1.16-py3-none-any.whl
Size 12.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
110141309b8a4fe0b8be589b83eb54ffbe78ff354b40b0c501c630550968ca87
BLAKE2b-256 checksum
How to use checksums
7e1c17cc2e96e188ee5500e4a394d394f35af064eaeb8d0f2001c576f827af6e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Security for openinference-instrumentation-smolagents 0.1.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.16 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page