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 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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file openinference_instrumentation_smolagents-0.1.2.tar.gz.

File metadata

File hashes

Hashes for openinference_instrumentation_smolagents-0.1.2.tar.gz
Algorithm Hash digest
SHA256 946e833116d3a9afeb082d6161f3d8e78f344f11c19206b6caee81903099138e
MD5 6597d43d49053e58f0957f0310806c11
BLAKE2b-256 245f7802ef38b06d5e54639e8a2b6e1fea6213c4dd5a5f140d2ddeaa889c9f02

See more details on using hashes here.

File details

Details for the file openinference_instrumentation_smolagents-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for openinference_instrumentation_smolagents-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 155772e267309af4007d82c7a2736c6f645e4d64bf1ff6ac1e324b4995b2a58c
MD5 bc329120a85fc98cc10294189253ba54
BLAKE2b-256 5b5ef25d60feabc1db19c20e78aaf0f7dc188d075c331c1bb075874185047412

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page