Installation
Usage
The LangWatch API key is configured by default via the
LANGWATCH_API_KEY environment variable.@langwatch.trace() decorator creates a parent trace for your graph execution. get_langchain_callback() goes in the config of agent.invoke(), and the same config argument works for ainvoke() and stream(). From there LangGraph passes it down: each node becomes a chain span named after the node, model calls become LLM spans, and tool calls become tool spans.
A callback attached only to the model call inside one node produces LLM spans alone. The tool nodes and the plain function nodes never appear, so the trace does not show which step the graph ran.
Related
- Capturing RAG - Learn how to capture RAG data from LangChain retrievers and tools
- Capturing Metadata and Attributes - Add custom metadata and attributes to your traces and spans
- Capturing Evaluations & Guardrails - Log evaluations and implement guardrails in your LangGraph applications