AgentTracer— wrap any agent to capture execution tracesCaseImporter— pull pre-existing runs from an observability platformManualTracer— instrument agents that don’t use a callback framework
ManualTracer
For any agent that doesn’t use a callback framework. You call the tracer explicitly from inside your agent code.tracer.step(thought) returns a context manager. Inside it, call record_tool_call(name, arguments, result) for each tool the agent uses and set_output(text) for the final answer.
You can also record calls at the top level without a step context:
LangChainTracer
For LangChain/LangGraph agents. Hooks intoBaseCallbackHandler to capture tool calls and agent steps automatically.
Your agent must accept and forward **kwargs so the callback handler reaches the underlying chain:
on_agent_action— agent’s reasoning thought and which tool to callon_tool_start/on_tool_end— tool inputs and resultson_tool_error— errors captured as[ERROR: ...]in the resulton_agent_finish— final output
LangSmithTracer
Same asLangChainTracer but also logs runs to LangSmith for observability. Teams already using LangSmith get both the eval trace and the LangSmith run record with no extra work.
langchain-core or langsmith is not installed, it silently falls back to trace-only mode (no LangSmith upload).
LangSmithImporter
Pull existing LangSmith runs as eval cases — no need to re-run your agent.run_on_cases grades each explicitly paired saved output without rerunning the
target. Judge-based graders may still make API calls. Missing target latency stays
unknown. See extension compatibility for
the development deprecation and migration of as_model_fn.
Filtering
EvalCase has:
input— extracted fromrun.inputs(auto-detected or set viainput_key=)agent_trace— populated from child runs (tool calls, LLM steps)metadata["_output"]— original run output (pass with its case torun_on_cases)metadata["_run_id"]— LangSmith run IDmetadata["_project"]— project namemetadata["_error"]— error string if the run failed
How tracers wire into EvalSuite
tracer.reset() before each case, runs the (instrumented) model function, then calls tracer.get_trace() and attaches the result to the case. The trace is then available to all agent evaluators.
Tracers require workers=1. Automatic worker selection uses 1 when a tracer
is present. Tracers are stateful; parallel cases would mix up their traces.
Building a custom tracer
ExtendAgentTracer to integrate with any framework:
CallbackTracer instead — it implements instrument() for you:
Building a custom importer
ExtendCaseImporter to pull runs from any observability platform:
load() and use run_on_cases for saved-output grading. The legacy
as_model_fn() helper is deprecated in development builds.
