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_helpersset_tracing_parent
Function●Since v0.7

set_tracing_parent

Copy
set_tracing_parent(
    run_tree: run_trees.RunTree,
) -> Generator[None, None, None]
View source on GitHub

Parameters

NameTypeDescription
run_tree*run_trees.RunTree

The RunTree to use as the active 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 precise control over which run acts as the parent without inheriting or overwriting other context variables.