/api/report in the background.
Install
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
Callconfigure() once at startup, or set the equivalent environment variables — the SDK reads them on import.
How the SDK works
- Calls into decorated functions emit
*_startand*_endevents throughtrack_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/reporton 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’son_*_start / on_*_end hooks. Register it once and every chain, tool, and LLM call inside the LangChain runtime emits events without further decoration.
Where to go next
Decorators
Full reference for
@agent, @chain, @tool.Event reporting
The event protocol, custom events, and
saved / chat semantics.
