TL;DR:
(a)evaluate() traces run automatically, but they don’t show in your dev tracing project — check the evaluation dataset’s linked traces instead.
Symptoms
Ran (a)evaluate() on a LangGraph function decorated with
@traceableExpected to see traces in development project
Didn’t see them, assumed tracing failed
Root Cause
This is a UI expectation mismatch:
(a)evaluate() traces are attached to the dataset used in the evaluation
They do not show in your default project’s run list
You must navigate to Dataset → Examples → Linked Traces to see them
Steps to Verify
Set required environment variables
export LANGSMITH_API_KEY=your_api_key
export LANGSMITH_TRACING=true
export LANGCHAIN_TRACING_V2=true # Needed for LangGraph eval tracing
Ensure function is wrapped with @traceable
Run (a)evaluate() with a valid dataset
client.aevaluate(your_func, "<dataset_id>")
View traces
Go to LangSmith → Datasets
Click your dataset
Go to Examples
Click Linked Traces
Common Pitfalls
ProblemSolution | |
No traces anywhere | LANGCHAIN_TRACING_V2 is set to true |
Wrong API key | Verify LANGSMITH_API_KEY matches the account you’re viewing |
Expecting traces in dev project | They’re in Dataset → Examples → Linked Traces |
Missing dataset ID | (a)evaluate() requires a valid dataset |
Minimal Working Example
import os, asyncio
from langsmith.run_helpers import traceable
from langsmith import Client
# Required env vars
os.environ["LANGCHAIN_TRACING_V2"] = "true"
os.environ["LANGSMITH_API_KEY"] = "<your_api_key>"
@traceable(name="plain_trace_test")
async def plain_traced_func(inputs: dict) -> dict:
return {"result": "plain trace works"}
async def main():
client = Client()
dataset_id = "<dataset_id>"
result = await client.aevaluate(plain_traced_func, dataset_id)
print("Result:", result)
asyncio.run(main())
Key Takeaways
(a)evaluate() does trace LangGraph runs
The traces are stored under the evaluation dataset’s linked traces
This is a UI navigation gotcha, not a tracing failure
References
https://docs.langchain.com/langsmith/evaluate-llm-application
https://docs.langchain.com/langsmith/evaluation-async