OpenInference smolagents Instrumentation
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 guardrailed LLM application
Install required packages.
pip install smolagents arize-phoenix opentelemetry-sdk opentelemetry-exporter-otlp
Start Phoenix in the background as a collector. By default, it listens on http://localhost:6006. You can visit the app via a browser at the same address. (Phoenix does not send data over the internet. It only operates locally on your machine.)
python -m phoenix.server.main serve
Set up SmolagentsInstrumentor to trace your crew and send the traces to Phoenix at the endpoint defined below.
from opentelemetry import trace
from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.sdk.trace.export import BatchSpanProcessor
from openinference.instrumentation.smolagents import SmolagentsInstrumentor
from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter
from opentelemetry.sdk.trace.export import ConsoleSpanExporter, SimpleSpanProcessor
endpoint = "http://0.0.0.0:6006/v1/traces"
trace_provider = TracerProvider()
trace_provider.add_span_processor(SimpleSpanProcessor(OTLPSpanExporter(endpoint)))
SmolagentsInstrumentor().instrument(tracer_provider=trace_provider)
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?")
More Info
Metadata
Release files for openinference-instrumentation-smolagents 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| openinference_instrumentation_smolagents-0.1.1.tar.gz | 10.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| openinference_instrumentation_smolagents-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 21.9 kB
Release files / openinference_instrumentation_smolagents-0.1.1.tar.gz
| Download URL | openinference_instrumentation_smolagents-0.1.1.tar.gz |
|---|---|
| Size | 10.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
14d21f590dbca71464c27d701c4280ed4a606e7b39e2930adf3252e41bbb5dbd
|
|
BLAKE2b-256 checksum How to use checksums |
d01351efdf9347b777635713917b76def4936c13648bcd76512beb76af789a58
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.8
|
Release files / openinference_instrumentation_smolagents-0.1.1-py3-none-any.whl
| Download URL | openinference_instrumentation_smolagents-0.1.1-py3-none-any.whl |
|---|---|
| Size | 11.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
93de42b2b5dc0eb2084f94cabe7e3235f582f565be8470afbb0570570ea7934e
|
|
BLAKE2b-256 checksum How to use checksums |
3c698885899faba36df3ae8448e5d5f0923a4248c82028249f7357c78a66dd92
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.8
|