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
  • RemoteGraph
⌘I

LangChain Assistant

Ask a question to get started

Enter to send•Shift+Enter new line

Menu

OverviewClientAsyncClientRun HelpersRun TreesEvaluationSchemasUtilitiesWrappersAnonymizerTestingExpect APIMiddlewarePytest PluginDeployment SDKRemoteGraph
Language
Theme
Pythonlangsmithrun_helpersset_tracing_parent
Function●Since v0.7

set_tracing_parent

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

Unlike tracing_context, this only sets _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.

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

Parameters

NameTypeDescription
run_tree*run_trees.RunTree

The RunTree to use as the active parent.

View source on GitHub