Zerda Observability

On this page

A generic, backend-agnostic tracing system for Zerda

Chains, RAG pipelines, routers, and agents all emit Span objects through a single process-wide Tracer. Any number of exporters can subscribe to that tracer at once — LangSmith, console, JSON, or a backend you write yourself.

Python · 6 lines
from zerda.observability import enable_langsmith

enable_langsmith(api_key="ls__...", project_name="Customer Support")

# Existing chains / RAG pipelines / routers now trace automatically —
# no code changes required.

What this module is

zerda.observability dependency-light tracing layer. It is not an OpenTelemetry wrapper and does not implement the OTel data model — it defines its own minimal Span shape and lets you export that shape anywhere you like.

The whole module is four moving pieces:

PieceFileRole
SpanspanA plain, mutable dataclass — the unit of tracing data.
TracertracingProcess-wide singleton that opens/closes spans and hands finished ones to exporters on a background thread.
BaseExporter and its subclassesexporters/Pluggable sinks: console, JSON file/buffer, LangSmith.
Module-level helpers__init__.pyenable_langsmith, enable_console, enable_json, get_tracer, trace, disable_tracing, is_tracing_enabled — the everyday entry points.

Where to go next

  • New to the module? Start with Installation and Quickstart.
  • Want to understand how the pieces fit together (including the background-thread export model and why disabled tracing is nearly free)? Read Architecture.
  • Wiring up LangSmith, console, or JSON output? See Configuration.
  • Writing your own exporter (OpenTelemetry, Langfuse, a custom dashboard)? See the Cookbook.
  • Looking for exact signatures, parameters, and return types? Go to the API Reference.
  • Something not behaving as expected? Check the FAQ & Troubleshooting.