Skip to main content
The Observatory SDK is the bridge between your code and the Observatory platform. Decorate your agents, chains, and tools; the SDK captures inputs, outputs, timings, token usage, and cost, then ships events to /api/report in the background.

Install

The distribution is named flx-observatory-lib; the import name is flowxobservatory. Optional extras pull in framework integrations — for example pip install flx-observatory-lib[langchain] or flx-observatory-lib[openai]. Python 3.12 or newer is required.

Configure

Call configure() once at startup, or set the equivalent environment variables — the SDK reads them on import.
Don’t ship the API key in source control. Use your platform’s secret manager.

How the SDK works

  • Calls into decorated functions emit *_start and *_end events through track_event.
  • The event queue is in-memory and non-blocking — your hot path is not on the critical send path.
  • A background consumer flushes batches to /api/report on a short interval.
  • Delivery is best-effort: if a batch fails to send, those events are dropped rather than blocking your app.

Where instrumentation belongs

Use them like Russian dolls. Each level nests under the previous one, producing the chain-of-calls visible in Traces.

LangChain and LangGraph

The SDK ships a callback handler that auto-captures LangChain’s on_*_start / on_*_end hooks. Register it once and every chain, tool, and LLM call inside the LangChain runtime emits events without further decoration.
LangGraph nodes are picked up through the same handler.

Where to go next

Decorators

Full reference for @agent, @chain, @tool.

Event reporting

The event protocol, custom events, and saved / chat semantics.
Last modified on June 3, 2026