Skip to Content

LangChain

Trace LangChain (and LangGraph) runs with Rius: chains, tools, retrievers, and model calls arrive as a nested trace mirroring your graph.

Setup

pip install "glassflow-ai[langchain]"
import glassflow glassflow.init(api_key="glassflow_...", service_name="my-agent") # build and run your chains exactly as before

The instrumentor hooks LangChain’s callback system, so anything that runs through it is traced: LCEL chains, agents, LangGraph nodes.

What gets captured

One span per step, typed by what the step is: chains as CHAIN spans, tool invocations as TOOL, retrievers as RETRIEVER, and model calls as LLM spans with model, token usage, and messages (cost computed server-side). The nesting follows your chain structure, so a trace reads like the execution graph.

Combining with client instrumentation

Installing langchain alongside a client extra (say openai) is fine: LangChain’s LLM span wraps the client library’s span. You get framework context and client-level detail, nested. Either alone also works; pick one if the double layer feels noisy.

Verify

Run one chain that calls a model, then open the trace in the console: you should see the chain’s structure as nested spans, with the LLM leaf carrying model, tokens, and cost.

All step inputs/outputs and messages are content attributes; privacy controls apply to the whole tree.

Last updated on