Smolagents
Smolagents is a framework from HuggingFace that allows you to create AI agents with various capabilities. The framework provides a simple way to build agents that can perform tasks like coding, searching the web, and more.
Opik integrates seamlessly with Smolagents through OpenTelemetry, allowing you to trace and monitor your agent executions in detail.

Getting started
First, ensure you have both opik
and smolagents
packages installed with the
telemetry components:
In addition, you can configure Opik using the opik configure
command:
Or programmatically:
Setting up OpenTelemetry for SmolAgents
To enable tracing of your SmolAgents execution with Opik, you need to set up OpenTelemetry. First, configure the necessary environment variables:
The projectName
and Comet-Workspace
headers are optional and can be set to Default
and default
respectively.
If you are using the self-hosted version of Opik, you will need to update the endpoint URL. You can learn more about
this in the Opik OpenTelemetry documentation.
Next, set up the instrumentation for SmolAgents:
Using SmolAgents with Opik
After setting up the instrumentation, you can use SmolAgents as usual. All agent executions will be automatically traced and sent to Opik:
With the OpenTelemetry configuration in place, all agent executions, including intermediate steps and tool usage, will be logged in Opik. This allows you to visualize the entire execution flow, examine inputs and outputs, and analyze the performance of your agents.
Features
The Opik integration with SmolAgents provides:
- Detailed tracing of agent execution flows
- Visualization of tool calls and their results
- Tracking of LLM inputs and outputs
- Performance metrics for agent executions
Further improvements
If you would like to see us improve this integration, simply open a new feature request on Github.