Respan instrumentation plugin for Braintrust
Project description
Respan Braintrust Instrumentation
Send Braintrust spans to Respan through the current Respan OTLP tracing pipeline.
Installation
pip install respan-ai respan-instrumentation-braintrust braintrust
Quick Start
import braintrust
from respan import Respan
from respan_instrumentation_braintrust import BraintrustInstrumentor
respan = Respan(instrumentations=[BraintrustInstrumentor()])
logger = braintrust.init_logger(
project="braintrust-demo",
async_flush=False,
)
with respan.propagate_attributes(group_identifier="Braintrust Demo"):
with logger.start_span(name="Braintrust Demo", type="task") as root:
with root.start_span(name="answer_question", type="llm") as span:
span.log(
input=[{"role": "user", "content": "What is Respan?"}],
output="Respan captures production LLM traces.",
metadata={"model": "gpt-4o-mini"},
metrics={"prompt_tokens": 8, "completion_tokens": 9},
)
logger.flush()
respan.flush()
respan.shutdown()
How It Works
BraintrustInstrumentor installs itself as Braintrust's background logger.
When Braintrust flushes, the instrumentor translates Braintrust records into
canonical Respan/OpenTelemetry spans and injects them into the same pipeline used
by respan-tracing.
The instrumentation maps Braintrust span types as follows:
llmandchat->chattoolandfunction->toolevalandautomation->workflowtask,score,facet, andpreprocessor->task
Braintrust-specific record fields are stored as metadata, while shared Respan
and GenAI span fields use constants from respan-sdk and upstream semantic
convention packages.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file respan_instrumentation_braintrust-0.1.0.tar.gz.
File metadata
- Download URL: respan_instrumentation_braintrust-0.1.0.tar.gz
- Upload date:
- Size: 6.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.3.4 CPython/3.12.12 Darwin/25.0.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7f64ea2ba326586a8c82f4b7d92c630e7ba3886af895d92aab6318a78c432fef
|
|
| MD5 |
5507f1e598b43afb65f58a0a0febb89d
|
|
| BLAKE2b-256 |
fa9e3059b58e0cd37c0113a608ad7c711ad869aa65de44df05b658212981e6a0
|
File details
Details for the file respan_instrumentation_braintrust-0.1.0-py3-none-any.whl.
File metadata
- Download URL: respan_instrumentation_braintrust-0.1.0-py3-none-any.whl
- Upload date:
- Size: 8.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.3.4 CPython/3.12.12 Darwin/25.0.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a37ccc2fdce1d856cdbf8c0fda947dd71040fa03172af9432fc0c73b9c60e944
|
|
| MD5 |
6b2b8e35d769392c3dc5751e215dd825
|
|
| BLAKE2b-256 |
4af9a5982dafcb1b4a1e38012c4766416635e58bb0dff753173e1b283593e07b
|