Skip to main content

HuggingFace Smolagents OpenTelemetry Integration

Overview

This integration provides support for using OpenTelemetry with the HuggingFace Smolagents framework. It enables tracing and monitoring of applications built with HuggingFace Smolagents.

Installation

  1. Install traceAI Smolagents
pip install traceAI-smolagents

Set Environment Variables

Set up your environment variables to authenticate with FutureAGI

import os

os.environ["FI_API_KEY"] = FI_API_KEY
os.environ["FI_SECRET_KEY"] = FI_SECRET_KEY

Quickstart

Register Tracer Provider

Set up the trace provider to establish the observability pipeline. The trace provider:

from fi_instrumentation import register
from fi_instrumentation.fi_types import ProjectType

trace_provider = register(
    project_type=ProjectType.OBSERVE,
    project_name="smolagents_app"
)

Configure Smolagents Instrumentation

Instrument the Smolagents client to enable telemetry collection.

from traceai_smolagents import SmolagentsInstrumentor

SmolagentsInstrumentor().instrument(tracer_provider=trace_provider)

Create Smolagents Components

Set up your Smolagents client with built-in observability.

from smolagents import (
    CodeAgent,
    DuckDuckGoSearchTool,
    OpenAIServerModel,
    ToolCallingAgent,
)

model = OpenAIServerModel(model_id="gpt-4o")
agent = ToolCallingAgent(
    tools=[DuckDuckGoSearchTool()],
    model=model,
    max_steps=3,
    name="search",
    description=(
        "This is an agent that can do web search. "
        "When solving a task, ask him directly first, he gives good answers. "
        "Then you can double check."
    ),
)
manager_agent = CodeAgent(
    tools=[DuckDuckGoSearchTool()],
    model=model,
    managed_agents=[agent],
)
manager_agent.run(
    "How many seconds would it take for a leopard at full speed to run through Pont des Arts? "
    "ASK YOUR MANAGED AGENT FOR LEOPARD SPEED FIRST"
)

Release files for traceAI-smolagents 0.1.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for traceAI-smolagents 0.1.5
File Size Uploaded
traceai_smolagents-0.1.5.tar.gz 5.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for traceAI-smolagents 0.1.5
File Interpreter ABI Platform
traceai_smolagents-0.1.5-py3-none-any.whl Python 3 none any Details

Total release size: 13.0 kB

Release files / traceai_smolagents-0.1.5.tar.gz

Download URL traceai_smolagents-0.1.5.tar.gz
Size 5.9 kB
Tags Source
SHA-256 checksum
How to use checksums
666841932b50d97f3c08690e0deca50c603cf6199449102538c3caefca8e8a51
BLAKE2b-256 checksum
How to use checksums
d133cef617ff911b739c43b8a06c47d0a87c8e266fffeb0a38f091d03da3be6b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.21 {"installer":{"name":"uv","version":"0.9.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / traceai_smolagents-0.1.5-py3-none-any.whl

Download URL traceai_smolagents-0.1.5-py3-none-any.whl
Size 7.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ef307088234b4080b06bebbd42decd4f3ca89cdfa486dcde7eaede2bbee3f19c
BLAKE2b-256 checksum
How to use checksums
f2e172fbdf7670b486516ea5fa44f2879916e1833e597c4330d3529e67b6d59a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.21 {"installer":{"name":"uv","version":"0.9.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

This release

0.1.5 This release

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

3 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page