smolagents Tracing
How to use the SmolagentsInstrumentor to trace smolagents by Hugging Face with Arize.
smolagents is a minimalist AI agent framework developed by Hugging Face, designed to simplify the creation and deployment of powerful agents. This guide shows how to instrument your smolagents application with OpenInference to send traces to Arize for observability.
API Key Setup
Before running your application, set the following environment variables:
You can find your Arize Space ID and API Key in your Arize account settings. The HF_TOKEN
is your Hugging Face API token.
Install
Install smolagents, the OpenInference instrumentor, Arize OTel, and supporting OpenTelemetry packages:
Setup Tracing
Add your HF_TOKEN
as an environment variable:
Connect to Arize using register
Create & Run an Agent Example
Here's an example of creating and running a smolagent. Traces will be automatically sent to Arize.
Observe in Arize
Now that you have tracing set up, all invocations and steps of your smolagents will be streamed to your Arize project for observability and evaluation. You can analyze agent behavior, tool usage, and LLM interactions within Arize.
Resources
Example Colab Notebook (adapt OTel setup for Arize)
Last updated
Was this helpful?