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.schemas.Run

Run schema for the V2 API in the Tracer.

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

tracers.schemas.BaseRun

Deprecated since version 0.1.0: Use Run instead.

tracers.schemas.ChainRun

Deprecated since version 0.1.0: Use Run instead.

tracers.schemas.LLMRun

Deprecated since version 0.1.0: Use Run instead.

tracers.schemas.ToolRun

Deprecated since version 0.1.0: Use Run instead.

tracers.schemas.TracerSession

Deprecated since version 0.1.0.

tracers.schemas.TracerSessionBase

Deprecated since version 0.1.0.

tracers.schemas.TracerSessionV1

Deprecated since version 0.1.0.

tracers.schemas.TracerSessionV1Base

Deprecated since version 0.1.0.

tracers.schemas.TracerSessionV1Create

Deprecated since version 0.1.0.

Deprecated functions

tracers.schemas.RunTypeEnum()

Deprecated since version 0.1.0: Use Use string instead. instead.