Skip to main content

OpenTelemetry instrumentation for Smolagents

Project description

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

Project details


Download files

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

Source Distribution

traceai_smolagents-0.1.3.tar.gz (5.9 kB view details)

Uploaded Source

Built Distribution

traceai_smolagents-0.1.3-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

Details for the file traceai_smolagents-0.1.3.tar.gz.

File metadata

  • Download URL: traceai_smolagents-0.1.3.tar.gz
  • Upload date:
  • Size: 5.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.0.0 CPython/3.13.0 Darwin/24.1.0

File hashes

Hashes for traceai_smolagents-0.1.3.tar.gz
Algorithm Hash digest
SHA256 a6f4b9db1c11eff14376418494a9c91bb4a84af8da0cd4d8d7b4d631af261a63
MD5 b43466c5804f0a48b56e34faff0ab2e2
BLAKE2b-256 3634321861923f1a54040d6ffcdb027b334cc080357f17a9deaf12cbd531157a

See more details on using hashes here.

File details

Details for the file traceai_smolagents-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: traceai_smolagents-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 7.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.0.0 CPython/3.13.0 Darwin/24.1.0

File hashes

Hashes for traceai_smolagents-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 035c13db55b30e9d3ffa25cd6e892fa7a5e8707ef38ecb2917d9972ec697d994
MD5 4668c6712ac5b359336b080900c2777a
BLAKE2b-256 371acc1ebcffcc0296c346d37bbc846bb29349ae0ba9da704ffafab7714ec71c

See more details on using hashes here.

Supported by

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