Metadata-Version: 2.4
Name: bentolabs-sdk
Version: 0.1.0
Summary: Official BentoLabs Python SDK. Drop-in OpenTelemetry span processor that ships traces to the BentoLabs ingest API over OTLP/HTTP+JSON.
Project-URL: Homepage, https://bentolabs.ai
License: Copyright (c) 2026 BentoLabs, Inc. All rights reserved.
        
        This software and the accompanying documentation (collectively, the
        "Software") are the proprietary and confidential property of BentoLabs,
        Inc. and are protected by copyright, trade secret, and other intellectual
        property laws.
        
        Use of the Software is governed by your written or click-through
        agreement with BentoLabs, Inc. — including but not limited to the
        BentoLabs Terms of Service, any applicable subscription, evaluation,
        or master services agreement, and any data processing or order form
        referencing this Software (collectively, the "Agreement").
        
        Except as expressly authorized under the Agreement, you may not:
        
          - copy, modify, or create derivative works of the Software;
          - distribute, sublicense, lease, lend, host, or otherwise transfer
            the Software, in source or object form, to any third party;
          - reverse-engineer, decompile, or disassemble the Software, except
            to the extent such restrictions are prohibited by applicable law;
          - use the Software to provide a service competitive with BentoLabs;
          - remove, obscure, or alter any proprietary notices in the Software.
        
        No rights are granted to you by implication, estoppel, or otherwise.
        All rights not expressly granted in the Agreement are reserved by
        BentoLabs, Inc.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
        OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
        MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
        IN NO EVENT SHALL BENTOLABS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES, OR
        OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT, OR OTHERWISE,
        ARISING FROM, OUT OF, OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
        OTHER DEALINGS IN THE SOFTWARE.
        
        For licensing inquiries, see https://bentolabs.ai.
License-File: LICENSE
Keywords: bentolabs,llm,observability,opentelemetry,otel,telemetry,tracing
Requires-Python: >=3.10
Requires-Dist: opentelemetry-api>=1.28.0
Requires-Dist: opentelemetry-sdk>=1.28.0
Description-Content-Type: text/markdown

# bentolabs-sdk

Official [BentoLabs](https://bentolabs.ai) Python SDK. A drop-in OpenTelemetry span processor that ships traces to the BentoLabs ingest API over OTLP/HTTP+JSON.

> **Status:** `0.1.0`. Stable surface for `api_key` / `base_url` resolution and OTel ingest. Higher-level helpers can land on top of this package later.

## Install

```bash
pip install bentolabs-sdk opentelemetry-api opentelemetry-sdk
```

## Usage

```python
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

```python
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` |

```python
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.
