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.4.tar.gz (6.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: traceai_smolagents-0.1.4.tar.gz
  • Upload date:
  • Size: 6.0 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.4.tar.gz
Algorithm Hash digest
SHA256 0d04991504b92360b5f931181756e6bd79acea288adcf6aced076b4b2f070469
MD5 7f4523837aff8d1902d5ba7a79a84404
BLAKE2b-256 a260b03897047f3f94f0cc44f1121c9fa96d6c440d58ff1509d1ee3442d5bd78

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for traceai_smolagents-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 0766162a1f5f1694c7d2311f329644b3fe72367d8eff8a270c81d843195c3f7d
MD5 58e2d30af4569295caa123c418637d2e
BLAKE2b-256 850896051fad7b3cb7a4080c9ed9ffbe85865c7cb5642a8347633e8bc22904c4

See more details on using hashes here.

Supported by

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