LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
  • Overview
    • Overview
    • Caches
    • Callbacks
    • Documents
    • Document loaders
    • Embeddings
    • Exceptions
    • Language models
    • Serialization
    • Output parsers
    • Prompts
    • Rate limiters
    • Retrievers
    • Runnables
    • Utilities
    • Vector stores
    MCP Adapters
    Standard Tests
    Text Splitters
    ⌘I

    LangChain Assistant

    Ask a question to get started

    Enter to send•Shift+Enter new line

    Menu

    OverviewCachesCallbacksDocumentsDocument loadersEmbeddingsExceptionsLanguage modelsSerializationOutput parsersPromptsRate limitersRetrieversRunnablesUtilitiesVector stores
    MCP Adapters
    Standard Tests
    Text Splitters
    Language
    Theme
    Pythonlangchain-coretracerscontexttracing_v2_enabled
    Functionā—Since v0.1

    tracing_v2_enabled

    Copy
    tracing_v2_enabled(
      project_name: str | None = None,
      *,
      example_id: str | UUID
    View source on GitHub
    |
    None
    =
    None
    ,
    tags
    :
    list
    [
    str
    ]
    |
    None
    =
    None
    ,
    client
    :
    LangSmithClient
    |
    None
    =
    None
    )
    ->
    Generator
    [
    LangChainTracer
    ,
    None
    ,
    None
    ]

    Parameters

    NameTypeDescription
    project_namestr | None
    Default:None

    The name of the project.

    Defaults to 'default'.

    example_idstr | UUID | None
    Default:None

    The ID of the example.

    tagslist[str] | None
    Default:None
    clientLangSmithClient | None
    Default:None

    Instruct LangChain to log all runs in context to LangSmith.

    Example:

    with tracing_v2_enabled(): ... # LangChain code will automatically be traced

    You can use this to fetch the LangSmith run URL:

    with tracing_v2_enabled() as cb: ... chain.invoke("foo") ... run_url = cb.get_run_url()

    The tags to add to the run.

    The client of the langsmith.