tracers#

Tracers are classes for tracing runs.

Class hierarchy:

BaseCallbackHandler --> BaseTracer --> <name>Tracer  # Examples: LangChainTracer, RootListenersTracer
                                   --> <name>  # Examples: LogStreamCallbackHandler

Classes

tracers.base.AsyncBaseTracer(*[, _schema_format])

Async Base interface for tracers.

tracers.base.BaseTracer(*[, _schema_format])

Base interface for tracers.

tracers.evaluation.EvaluatorCallbackHandler(...)

Tracer that runs a run evaluator whenever a run is persisted.

tracers.event_stream.RunInfo

Information about a run.

tracers.langchain.LangChainTracer([...])

Implementation of the SharedTracer that POSTS to the LangChain endpoint.

tracers.log_stream.LogEntry

A single entry in the run log.

tracers.log_stream.LogStreamCallbackHandler(*)

Tracer that streams run logs to a stream.

tracers.log_stream.RunLog(*ops, state)

Run log.

tracers.log_stream.RunLogPatch(*ops)

Patch to the run log.

tracers.log_stream.RunState

State of the run.

tracers.root_listeners.AsyncRootListenersTracer(*, ...)

Async Tracer that calls listeners on run start, end, and error.

tracers.root_listeners.RootListenersTracer(*, ...)

Tracer that calls listeners on run start, end, and error.

tracers.run_collector.RunCollectorCallbackHandler([...])

Tracer that collects all nested runs in a list.

tracers.stdout.ConsoleCallbackHandler(**kwargs)

Tracer that prints to the console.

tracers.stdout.FunctionCallbackHandler(...)

Tracer that calls a function with a single str parameter.

Functions

tracers.context.collect_runs()

Collect all run traces in context.

tracers.context.register_configure_hook(...)

Register a configure hook.

tracers.context.tracing_enabled([session_name])

Throw an error because this has been replaced by tracing_v2_enabled.

tracers.context.tracing_v2_enabled([...])

Instruct LangChain to log all runs in context to LangSmith.

tracers.evaluation.wait_for_all_evaluators()

Wait for all tracers to finish.

tracers.langchain.get_client()

Get the client.

tracers.langchain.log_error_once(method, ...)

Log an error once.

tracers.langchain.wait_for_all_tracers()

Wait for all tracers to finish.

tracers.langchain_v1.LangChainTracerV1(...)

Throw an error because this has been replaced by LangChainTracer.

tracers.langchain_v1.get_headers(*args, **kwargs)

Throw an error because this has been replaced by get_headers.

tracers.stdout.elapsed(run)

Get the elapsed time of a run.

tracers.stdout.try_json_stringify(obj, fallback)

Try to stringify an object to JSON.

Deprecated classes

Deprecated functions