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 AX for observability.

Check out the Colab for an interactive example (you may need to adapt OTel setup for Arize as shown below).

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 AX using register

Create & Run an Agent Example

Here's an example of creating and running a smolagent. Traces will be automatically sent to Arize AX.

Observe in Arize AX

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

Resources

Last updated

Was this helpful?