Skip to main content
LangGraph uses LangChain’s callback system, so Lemma’s LangGraph integration is an explicit LangChain callback adapter with LangGraph defaults (default trace name langgraph-agent). It creates one owned Lemma trace per graph invocation, records graph nodes as nested child spans, model calls as generations, tools as tool calls, extracts current-turn input from graph message state, and preserves parent run IDs with orphan-safe fallback. You do not need to wrap graph calls in lemma.trace(). Pass the callback handler through the graph invoke config.

TypeScript

Install LangGraph and the Lemma SDK:
Pass langGraph() in the graph invoke config:

Python

Install the optional extra:
Pass langgraph() in the graph invoke config:

What Lemma records

langGraph() / langgraph() is an explicit LangChain-callback adapter — LangGraph emits LangChain callback events; Lemma does not use a separate LangGraph tracer. Prompts, tool inputs, outputs, model output text, and error messages are always recorded. Redact secrets and sensitive user data before they reach the graph.

Debugging

Enable debug mode while developing to confirm that spans arrive live and parent IDs are attached: