1
Curious builder0 XP earned · 300 to level 2
0 daysFinish a lesson to begin
Badge collection0 of 6 unlocked
38 small wins to finish your path
LangSmith: see what a run did
LangSmith records every run so you can read it back step by step. You set two environment variables before running, and tracing turns on with no code change.
Last updated: 27 Sep, 2026 · LangSmith
When an answer is wrong, logs rarely show why. A trace shows each node, each model call, and what it sent and got back, so you can find the step that failed.
The tracing environment variables
export LANGSMITH_TRACING=true
export LANGSMITH_API_KEY=your_key
export LANGSMITH_PROJECT=support-agent # optionalWhat tracing records
- With those variables set, LangChain and LangGraph detect them and trace every run automatically, no code change needed.
- Each run appears in LangSmith as a tree of steps you can open and read.
- The older
LANGCHAIN_TRACING_V2andLANGCHAIN_API_KEYnames still work; theLANGSMITH_names are current.
When to turn on tracing
- Finding the step where a run went wrong or got expensive.
- Watching what a live agent sends to the model.
Watch out. Tracing records runs only after it is switched on. Set the variables before you run, or the run you wanted to inspect is not captured. Turn it on before you need it.
Related
- Previous: Deploy: langgraph dev and langgraph.json
- Reference: LangSmith observability
Try it yourself
- Set the variables, run any earlier lesson's graph, and open the trace.
- Name the project and confirm the run lands under it.
You understood something today that you didn't yesterday.