Observability, replay, and regression testing for AI agents: OpenTelemetry tracing with automatic instrumentation for OpenAI, Anthropic, and Hugging Face models.
pip install obzerve==0.1.0 Copy PIP instructions
obzerve traces what your agent does: LLM calls, tool calls, retrieval, and handoffs. Traces go to a self-hosted Obzerve server, where you can see the timeline, latency, errors, token usage, and estimated cost of every request. When something goes wrong, the SDK can replay the exact execution from its recordings and turn it into a regression test that gates your next release.
The SDK is built on OpenTelemetry and sends standard OTLP.
pip install obzerve # or: uv add obzerve pip install "obzerve[openai]" # plus the client libraries you use: openai, anthropic, # huggingface, transformers, or all You need a running Obzerve server and a project API key. See the getting-started guide; make stack-demo starts one locally in containers.
from obzerve import Observer observer = Observer(endpoint="http://localhost:8000", api_key="obz_...", service_name="support-bot") observer.instrument() # trace OpenAI, Anthropic and Hugging Face calls automatically def handle(ticket): with observer.trace("support_bot", input={"ticket": ticket}) as trace: answer = ... # your agent: every LLM call inside becomes a span of this trace trace.set_output(answer) return answer Automatic instrumentation observer.instrument() patches the supported client libraries that are installed. Every model call becomes an LLM span inside the active trace, recording:
observer.instrument(openai=True, anthropic=False) # True: require it; False: skip it; # None (default): instrument it if installed handle = observer.instrument() handle.uninstrument() # restore the original libraries transformers loads PyTorch on import, so by default it is instrumented only if your code has already imported it. Pass transformers=True to instrument it regardless.
Instrumentation never breaks your call: if a library changes shape, you lose telemetry, not the request. A streamed response stays open as one span until you finish reading it, close it, or leave its with block. Close streams you stop reading early.
from obzerve import SpanKind with observer.span("search_orders", kind=SpanKind.TOOL, input={"customer": cid}) as span: orders = orders_api.search(cid) span.set_output(orders) @observer.observe(kind=SpanKind.RETRIEVAL) # decorator form, sync or async def retrieve(query: str) -> list[str]: ... Exceptions mark the span as failed, with the error type and message. span.record_retry(attempt, exc) records retries. span.set_llm(model=..., input_tokens=..., output_tokens=...) records model usage for calls the instrumentation doesn't cover.
Calls through the instrumented libraries are recorded exactly: the whole response, rebuilt as the library's own response type during a replay. For your own tools, use @observer.replayable:
@observer.replayable(kind=SpanKind.TOOL) def lookup_order(order_id: str) -> dict: ... @observer.replayable(kind=SpanKind.TOOL, side_effect=True) # never re-run by a replay def refund(order_id: str) -> None: ... Then reproduce a production request, without calling any model or tool:
from obzerve.client import ObzerveClient from obzerve.replay import RECORDED, LLM_LIVE bundle = ObzerveClient("http://localhost:8000", api_key).replay_bundle(trace_id) with observer.replay(bundle, RECORDED): # or LLM_LIVE: tools recorded, model live handle(**bundle.root_input) Turn the trace into a regression case, run your eval dataset against a change, and gate the release in CI:
obzerve case add --dataset regressions --name "refund flow" --mode recorded --no-error obzerve eval gate --max-regressions 0 # exits 1 on failure Run datasets with obzerve.evals.run_eval. The main README covers the full workflow.
All 2 files in this release have provenance metadata.
all anthropic huggingface openai transformers
agents ai-agents anthropic evals huggingface llm observability openai opentelemetry replay tracing transformers
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 26, 2026.
All 2 files in this release have been uploaded with provenance metadata.
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.




