/docs/integrations/ObsrvCallbackHandler
LangChain
Wrap a LangChain runnable so inputs, outputs, timing, and errors are emitted as obsrv traces.
Python
from langchain_anthropic import ChatAnthropic
from theta_observability import TraceClient
from theta_observability.integrations import wrap_langchain_runnable
client = TraceClient()
llm = ChatAnthropic(model="claude-sonnet-4-6")
traced_llm = wrap_langchain_runnable(llm, client, name="support-chain")
result = traced_llm.invoke("Hello")Node
import { ChatAnthropic } from "@langchain/anthropic";
import { TraceClient } from "@theta-lab/obsrv";
import { wrapLangChainRunnable } from "@theta-lab/obsrv/langchain";
const client = new TraceClient();
const llm = new ChatAnthropic({ model: "claude-sonnet-4-6" });
const tracedLlm = wrapLangChainRunnable(llm, { client, name: "support-chain" });
await tracedLlm.invoke("Hello");What gets captured
- Runnable inputs as user messages.
- Runnable outputs as assistant messages.
- Timing, status, and thrown errors.
- LangChain config tags and metadata when provided.