The reference implementation.
pip install agentobs — zero required dependencies, all 10 AGENTOBS namespaces, a full CLI, and integrations for OpenAI, LangChain, LlamaIndex, CrewAI, and Datadog.
Get started in one command.
Install the base SDK with no required dependencies. Add optional extras for the integrations and export targets you need.
Verify the installation:
agentobs --version # agentobs 1.0.8 [AGENTOBS-Enterprise-2.0]
Optional extras
| Extra | What it adds |
|---|---|
| agentobs[jsonschema] | Enables runtime schema validation of every emitted event against the published JSON Schema. |
| agentobs[openai] | Auto-instrumentation for the openai Python client — wraps chat completions, embeddings, and responses. |
| agentobs[http] | OTLP/HTTP export and webhook export targets. |
| agentobs[pydantic] | Pydantic v2 model support for typed payload validation. |
| agentobs[otel] | Full OpenTelemetry SDK integration — exports spans as OTLP proto via grpc or http. |
| agentobs[kafka] | Apache Kafka export backend for streaming event pipelines. |
| agentobs[langchain] | LangChain callback handler — instruments chain, tool, and LLM calls automatically. |
| agentobs[llamaindex] | LlamaIndex event handler — instruments query, retrieval, and LLM calls. |
| agentobs[crewai] | CrewAI task-and-agent lifecycle instrumentation. |
| agentobs[datadog] | Datadog exporter — ships events to DD APM as custom spans. |
| agentobs[all] | Installs all optional extras in a single command. |
Your first event.
Every event in the AGENTOBS standard is an Event object with three required arguments: event_type, source, and payload.
from agentobs import Event
# Minimal event
event = Event(
event_type="llm.trace.span",
source="my-service@0.1.0",
payload={"span_name": "summarise", "status": "ok"},
)
# Event is ready to emit or inspect
print(event.event_id) # ULID e.g. 01HZQSN7PQVR2K4M0BXJD3GSTA
print(event.timestamp) # ISO-8601 UTC
print(event.trace_id) # W3C-compatible 128-bit hexTyped namespace payloads
Use the typed payload classes from each namespace for full schema validation and IDE autocompletion. The classes map 1-to-1 to the published JSON Schema.
from agentobs import Event
from agentobs.namespaces.trace import SpanPayload, TokenUsage, ModelInfo
event = Event(
event_type="llm.trace.span",
source="spanforge@1.0.0",
payload=SpanPayload(
span_name="summarise_document",
span_kind="LLM",
status="ok",
duration_ms=830,
token_usage=TokenUsage(prompt=411, completion=128, total=539),
model_info=ModelInfo(provider="openai", model="gpt-4o"),
),
tags=["prod", "summarisation"],
)
# Export to OTLP
from agentobs.export import OTLPExporter
exporter = OTLPExporter(endpoint="http://localhost:4317")
exporter.export(event)Works with your existing stack.
Install the relevant extra and add one line of code. AGENTOBS events are emitted automatically — you retain full visibility without rewriting your instrumentation.
OpenAI
One-line auto-instrumentation for the openai Python client. Wraps chat completions, embeddings, and the Responses API. Emits llm.trace.span and llm.cost.* events automatically.
LangChain
Drop-in callback handler. Instruments chain invocations, tool calls, and LLM calls. Compatible with LangChain v0.1 and v0.2.
LlamaIndex
Event handler for the LlamaIndex instrumentation API. Captures query, retrieval, embedding, and LLM events with full trace context.
CrewAI
Task and agent lifecycle instrumentation for CrewAI. Captures agent run start/end, task assignment, and tool delegation events.
Datadog
Export agentobs span events as custom Datadog APM spans. Compatible with the Datadog Agent and the dd-trace-py client.
OpenTelemetry
Full OTLP bridge. Converts agentobs span events to OpenTelemetry proto-compatible dicts and exports via gRPC or HTTP. Works with any OTEL-compatible backend.
Operational tooling included.
The agentobs CLI is installed automatically with the SDK. Use it for health checks, schema validation, audit-chain verification, and migration tooling.
# End-to-end health check agentobs check # [1/5] Config ............. OK # [2/5] Event creation ..... OK # [3/5] Schema validation .. OK # [4/5] Export pipeline .... OK # [5/5] Trace store ........ OK # All checks passed. # Validate a JSONL event stream agentobs validate production-events.jsonl # Lint your instrumentation code python -m agentobs.lint src/
SDK instrumentation linter.
The built-in linter parses your Python source with ast and runs five checks to catch common instrumentation mistakes before they reach production. Integrates natively with flake8 and ruff.
Inspect. Validate. Ship.
Use AgentOBSDebug to inspect and replay traces, and AgentOBSValidate to enforce schema compliance in your CI pipeline.