obslog¶
AI-native, domain-agnostic observability SDK for Python. Structured logging is its first capability; the architecture extends to tracing, metrics, audit, and diagnostics without breaking changes.
Traditional logging answers "what happened?". obslog is built so its output also answers "why did it happen, what evidence exists, and how can an external AI agent reconstruct the root cause?" — by emitting stable, machine-readable, correlated evidence instead of prose. obslog never calls an LLM; it produces the deterministic evidence an LLM (or a human) consumes.
Highlights¶
- Evidence, not narrative — events are stable dotted names + structured fields.
- Deterministic & machine-readable — a published, versioned Record schema is the contract for AI and test consumers.
- Correlated by default —
execution_id/trace_id/parent_executionflow across calls andasyncboundaries viacontextvars. - Domain-agnostic — the SDK carries and structures metadata; it never interprets business semantics.
- Zero required dependencies — the core is stdlib-only; integrations are optional.
- Library-safe — no mandatory global logger; isolated providers are first-class.
Install¶
pip install obslog
# optional extras:
pip install "obslog[yaml]" # YAML configuration
pip install "obslog[otel]" # OpenTelemetry exporter
30-second example¶
import obslog
log = obslog.get_logger(__name__)
log.info("order.completed", order_id=7, duration_ms=12)
with obslog.context(execution_id=obslog.new_id(), request_id="req-42"):
with log.operation("charge_card", phase="authorize") as op:
op.set(amount=100)
...
Where to next¶
- New here? Start with the Getting started tutorial.
- Configuring output? See the Configuration guide.
- Building an integration? See Plugins & Integrations.
- Curious how it works? Read the Architecture and AI diagnostics explanations.
The authoritative specification is PRODUCT.md in the repository root; every feature
traces back to a requirement there.