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.1.tar.gz (72.2 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.1-py3-none-any.whl (29.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: bentolabs_sdk-0.2.1.tar.gz
  • Upload date:
  • Size: 72.2 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.1.tar.gz
Algorithm Hash digest
SHA256 0e6c7fa392360e04ce17e36512602f6f66e04ea5a40551458fb7b078f4db62f3
MD5 8b2073894edbf4eea1ae0cf521b96aa5
BLAKE2b-256 aaabd902c56d03fddbfcdcda313da0ac923d1a82f98824ccc87fac47fa627286

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bentolabs_sdk-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 29.7 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8a067fe6c4d99948a7acb6b930fc1c88e06804da1e237c6663a7b515e0f63bd1
MD5 1bc71da6f38e1b6952c5f24f012d9f3a
BLAKE2b-256 7fa79d5108432401d83cb4e5d3f8d5e94fe93ddce36133bacdb888a6d26d207a

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