Skip to main content

Official BentoLabs Python SDK. Drop-in OpenTelemetry span processor that ships traces to the BentoLabs ingest API over OTLP/HTTP+JSON.

Project description

bentolabs-sdk

Official BentoLabs Python SDK. A drop-in OpenTelemetry span processor that ships traces to the BentoLabs ingest API over OTLP/HTTP+JSON.

Status: 0.2.0. Stable surface for api_key / base_url resolution and OTel ingest, plus the higher-level analytics convenience layer.

Two layers

This package ships two surfaces. Pick whichever fits:

  • Analytics convenience layer (bentolabs_sdk.analytics) — Raindrop-shaped functions (init, track_ai, flush, shutdown). You don't manage the OTel pipeline yourself; just call bento.track_ai(...) and data lands in your dashboard. Start here: INTEGRATION.md — one-pager covering every kwarg, the dashboard feature it powers, and common mistakes.
  • OTel transport (BentoLabsSpanProcessor, BentoLabsTraceExporter) — wire the SDK into your existing OpenTelemetry pipeline. The rest of this README covers it.

Install

pip install bentolabs-sdk opentelemetry-api opentelemetry-sdk

Usage

from opentelemetry import trace
from opentelemetry.sdk.trace import TracerProvider

from bentolabs_sdk import BentoLabsSpanProcessor

provider = TracerProvider()
provider.add_span_processor(BentoLabsSpanProcessor())
trace.set_tracer_provider(provider)

tracer = trace.get_tracer("example")
with tracer.start_as_current_span("agent.run") as span:
    span.set_attribute("input.value", "Summarize the incident")
    span.set_attribute("output.value", "The incident is resolved.")

provider.force_flush()
provider.shutdown()

The processor batches spans with OpenTelemetry defaults and POSTs them to ${base_url}/v1/traces with Authorization: Bearer bl_pk_.... The bl_pk_ prefix is validated up front.

Configuration

from bentolabs_sdk import resolve_options

cfg = resolve_options()
Field Resolution order
api_key explicit argument -> BENTOLABS_API_KEY -> raises BentoAuthError
base_url explicit argument -> BENTOLABS_BASE_URL -> https://api.bentolabs.ai
from bentolabs_sdk import BentoAuthError, BentoLabsSpanProcessor

try:
    processor = BentoLabsSpanProcessor(base_url="http://localhost:8080")
except BentoAuthError as exc:
    if exc.code == "missing_api_key":
        # telemetry disabled or misconfigured
        pass
    raise

Requirements

  • Python 3.10+

License

Proprietary. Copyright (c) 2026 BentoLabs, Inc. All rights reserved. Use is governed by your written agreement with BentoLabs, Inc.

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

bentolabs_sdk-0.2.0.tar.gz (40.3 kB view details)

Uploaded Source

Built Distribution

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

bentolabs_sdk-0.2.0-py3-none-any.whl (18.1 kB view details)

Uploaded Python 3

File details

Details for the file bentolabs_sdk-0.2.0.tar.gz.

File metadata

  • Download URL: bentolabs_sdk-0.2.0.tar.gz
  • Upload date:
  • Size: 40.3 kB
  • Tags: Source
  • Uploaded using 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}

File hashes

Hashes for bentolabs_sdk-0.2.0.tar.gz
Algorithm Hash digest
SHA256 c80a75227405bea79cb002564665664e250b34fbd591dc30d3071298ee48e019
MD5 85e523bf5cf289b1d7bda8f50da4c652
BLAKE2b-256 4bad64c8eeab03765d8318b3491ddf69b7fe9d26c27b2bf03dc324447ec11511

See more details on using hashes here.

File details

Details for the file bentolabs_sdk-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: bentolabs_sdk-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 18.1 kB
  • Tags: Python 3
  • Uploaded using 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}

File hashes

Hashes for bentolabs_sdk-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6f7b3e74da5b564dcad147f21541bc3ba26ca88a80bd48fd6ccef2118bc96f95
MD5 39e5056848907da1bf336667f5afb47f
BLAKE2b-256 e50682fcbb18b3969d6a4cde3e9c6348c7751a78d0f10968975e966788813598

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