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.as_model_fn(cases) returns a replay function that returns each run’s original output in order — no model calls needed.
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 (used byas_model_fn)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 (the default). Tracers are stateful — running cases in parallel would mix up 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:
as_model_fn() is provided by the base class — no need to implement it.
