LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
  • Overview
  • Client
  • AsyncClient
  • Run Helpers
  • Run Trees
  • Evaluation
  • Schemas
  • Utilities
  • Wrappers
  • Anonymizer
  • Testing
  • Expect API
  • Middleware
  • Pytest Plugin
  • Deployment SDK
⌘I

LangChain Assistant

Ask a question to get started

Enter to send•Shift+Enter new line

Menu

OverviewClientAsyncClientRun HelpersRun TreesEvaluationSchemasUtilitiesWrappersAnonymizerTestingExpect APIMiddlewarePytest PluginDeployment SDK
Language
Theme
PythonlangsmithRun Helpers

Run Helpers

Functions for tracing and observability, including the traceable decorator, trace context manager, and tracing context management utilities.

Classes

Class

trace

Manage a LangSmith run in context.

This class can be used as both a synchronous and asynchronous context manager.

Experimental

address is in beta. It is enabled per workspace; a

Class

LangSmithExtra

Any additional info to be injected into the run dynamically.

Functions

Function

traceable

Trace a function with langsmith.

Experimental

address is in beta. It is enabled per workspace; a workspace without it rejects the runs, so tracing is lost rather than fall

Function

get_current_run_tree

Get the current run tree.

Uses a weakref-based lookup to avoid memory leaks from captured contexts. The RunTree may return None if it has been garbage collected.

Function

set_tracing_parent

Set a RunTree as the active tracing parent within this block.

Unlike tracing_context, this only sets the parent run tree and nothing else, making it safe to use in isolated threads where you want p

Function

set_run_metadata

Update metadata on the current run tree.

Function

get_tracing_context

Get the current tracing context.

Function

tracing_context

Set the tracing context for a block of code.

Experimental

address is in beta. It is enabled per workspace; a workspace without it rejects the runs, so tracing is lost rather t

Function

is_traceable_function

Check if a function is @traceable decorated.

Function

ensure_traceable

Ensure that a function is traceable.

Function

as_runnable

Convert a function wrapped by the LangSmith @traceable decorator to a Runnable.