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

configure

Configure global LangSmith tracing context.

This function allows you to set global configuration options for LangSmith tracing that will be applied to all subsequent traced operations. It modifies context variables that control tracing behavior across your application.

Do this once at startup to configure the global settings in code.

If, instead, you wish to only configure tracing for a single invocation, use the tracing_context context manager instead.

Copy
configure(
  client: Optional[Client] = _SENTINEL,
  enabled: Optional[bool] = _SENTINEL,
  project_name: Optional[str] = _SENTINEL,
  tags: Optional[list[str]] = _SENTINEL,
  metadata: Optional[dict[str, Any]] = _SENTINEL
)

Used in Docs

  • Trace PydanticAI applications
  • Trace Semantic Kernel applications
  • Trace with OpenTelemetry

Parameters

NameTypeDescription
clientOptional[Client]
Default:_SENTINEL

A LangSmith Client instance to use for all tracing operations.

If provided, this client will be used instead of creating new clients.

Pass None to explicitly clear the global client.

enabledOptional[bool]
Default:_SENTINEL

Whether tracing is enabled.

Can be:

  • True: Enable tracing and send data to LangSmith
  • False: Disable tracing completely
  • 'local': Enable tracing but only store data locally
  • None: Clear the setting (falls back to environment variables)
project_nameOptional[str]
Default:_SENTINEL

The LangSmith project name where traces will be sent.

This determines which project dashboard will display your traces.

Pass None to explicitly clear the project name.

tagsOptional[list[str]]
Default:_SENTINEL

A list of tags to be applied to all traced runs.

Tags are useful for filtering and organizing runs in the LangSmith UI.

Pass None to explicitly clear all global tags.

metadataOptional[dict[str, Any]]
Default:_SENTINEL

A dictionary of metadata to attach to all traced runs.

Metadata can store any additional context about your runs.

Pass None to explicitly clear all global metadata.

View source on GitHub