Skip to content
masterclass Buddy

LangSmith · Function

tracing_context

A Python context manager that changes LangSmith tracing for one block of code. It can enable or disable tracing and add request-specific routing, tags, and metadata.

Last updated

Since
v0.5

Syntax

tracing_context(*, project_name: Optional[str] = None, address: Optional[AgentAddress] = None, tags: Optional[list[str]] = None, metadata: Optional[dict[str, Any]] = None, parent: Optional[Union[run_trees.RunTree, Mapping, str, Literal[False]]] = None, enabled: Optional[Union[bool, Literal['local']]] = None, client: Optional[ls_client.Client] = None, replicas: Optional[Sequence[Union[WriteReplica, str]]] = None, distributed_parent_id: Optional[str] = None, **kwargs: Any) -> Generator[None, None, None]

In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.

Subscribe
  • traceable
  • agent_address
  • Client
  • ls.configure
  • replicas

Source: tracing_context | langsmith | LangChain Reference. Checked 2026-11-03.