Home / File/ manager.py — langchain Source File

manager.py — langchain Source File

Architecture documentation for manager.py, a python file in the langchain codebase. 28 imports, 0 dependents.

File python CoreAbstractions Serialization 28 imports 13 functions 17 classes

Entity Profile

Dependency Diagram

graph LR
  35cf5db6_bcb1_b854_6ebb_5e0368e51b58["manager.py"]
  a327e534_84f6_5308_58ca_5727d5eda0cf["asyncio"]
  35cf5db6_bcb1_b854_6ebb_5e0368e51b58 --> a327e534_84f6_5308_58ca_5727d5eda0cf
  d2d385e5_a034_be0d_f382_bdc66a2c0256["atexit"]
  35cf5db6_bcb1_b854_6ebb_5e0368e51b58 --> d2d385e5_a034_be0d_f382_bdc66a2c0256
  c990f2d7_9509_7cea_ca95_51ad57dbe5c6["functools"]
  35cf5db6_bcb1_b854_6ebb_5e0368e51b58 --> c990f2d7_9509_7cea_ca95_51ad57dbe5c6
  2a7f66a7_8738_3d47_375b_70fcaa6ac169["logging"]
  35cf5db6_bcb1_b854_6ebb_5e0368e51b58 --> 2a7f66a7_8738_3d47_375b_70fcaa6ac169
  cccbe73e_4644_7211_4d55_e8fb133a8014["abc"]
  35cf5db6_bcb1_b854_6ebb_5e0368e51b58 --> cccbe73e_4644_7211_4d55_e8fb133a8014
  cfe2bde5_180e_e3b0_df2b_55b3ebaca8e7["collections.abc"]
  35cf5db6_bcb1_b854_6ebb_5e0368e51b58 --> cfe2bde5_180e_e3b0_df2b_55b3ebaca8e7
  082415a8_067b_221f_7984_07d87009267d["concurrent.futures"]
  35cf5db6_bcb1_b854_6ebb_5e0368e51b58 --> 082415a8_067b_221f_7984_07d87009267d
  69e1d8cc_6173_dcd0_bfdf_2132d8e1ce56["contextlib"]
  35cf5db6_bcb1_b854_6ebb_5e0368e51b58 --> 69e1d8cc_6173_dcd0_bfdf_2132d8e1ce56
  e7c46dc4_ca3a_87ac_156f_0aa3d9b9d3f4["contextvars"]
  35cf5db6_bcb1_b854_6ebb_5e0368e51b58 --> e7c46dc4_ca3a_87ac_156f_0aa3d9b9d3f4
  8e2034b7_ceb8_963f_29fc_2ea6b50ef9b3["typing"]
  35cf5db6_bcb1_b854_6ebb_5e0368e51b58 --> 8e2034b7_ceb8_963f_29fc_2ea6b50ef9b3
  ae8a5181_678b_4c6a_5dab_f5850ee1ed20["langsmith.run_helpers"]
  35cf5db6_bcb1_b854_6ebb_5e0368e51b58 --> ae8a5181_678b_4c6a_5dab_f5850ee1ed20
  91721f45_4909_e489_8c1f_084f8bd87145["typing_extensions"]
  35cf5db6_bcb1_b854_6ebb_5e0368e51b58 --> 91721f45_4909_e489_8c1f_084f8bd87145
  7e64d143_ea36_1c73_4897_1d0ae1757b5b["langchain_core.callbacks.base"]
  35cf5db6_bcb1_b854_6ebb_5e0368e51b58 --> 7e64d143_ea36_1c73_4897_1d0ae1757b5b
  abb72023_d38b_8b3e_578b_e9c61bbab112["langchain_core.callbacks.stdout"]
  35cf5db6_bcb1_b854_6ebb_5e0368e51b58 --> abb72023_d38b_8b3e_578b_e9c61bbab112
  style 35cf5db6_bcb1_b854_6ebb_5e0368e51b58 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

"""Run managers."""

from __future__ import annotations

import asyncio
import atexit
import functools
import logging
from abc import ABC, abstractmethod
from collections.abc import Callable
from concurrent.futures import ThreadPoolExecutor
from contextlib import asynccontextmanager, contextmanager
from contextvars import copy_context
from typing import TYPE_CHECKING, Any, TypeVar, cast

from langsmith.run_helpers import get_tracing_context
from typing_extensions import Self, override

from langchain_core.callbacks.base import (
    BaseCallbackHandler,
    BaseCallbackManager,
    Callbacks,
    ChainManagerMixin,
    LLMManagerMixin,
    RetrieverManagerMixin,
    RunManagerMixin,
    ToolManagerMixin,
)
from langchain_core.callbacks.stdout import StdOutCallbackHandler
from langchain_core.globals import get_debug
from langchain_core.messages import BaseMessage, get_buffer_string
from langchain_core.tracers.context import (
    _configure_hooks,
    _get_trace_callbacks,
    _get_tracer_project,
    _tracing_v2_is_enabled,
    tracing_v2_callback_var,
)
from langchain_core.tracers.langchain import LangChainTracer
from langchain_core.tracers.stdout import ConsoleCallbackHandler
from langchain_core.utils.env import env_var_is_set
from langchain_core.utils.uuid import uuid7

if TYPE_CHECKING:
    from collections.abc import AsyncGenerator, Coroutine, Generator, Sequence
    from uuid import UUID

    from tenacity import RetryCallState

    from langchain_core.agents import AgentAction, AgentFinish
    from langchain_core.documents import Document
    from langchain_core.outputs import ChatGenerationChunk, GenerationChunk, LLMResult
    from langchain_core.runnables.config import RunnableConfig
    from langchain_core.tracers.schemas import Run

logger = logging.getLogger(__name__)


def _get_debug() -> bool:
    return get_debug()
// ... (2628 more lines)

Subdomains

Dependencies

  • abc
  • asyncio
  • atexit
  • collections.abc
  • concurrent.futures
  • contextlib
  • contextvars
  • functools
  • langchain_core.agents
  • langchain_core.callbacks.base
  • langchain_core.callbacks.stdout
  • langchain_core.documents
  • langchain_core.globals
  • langchain_core.messages
  • langchain_core.outputs
  • langchain_core.runnables.config
  • langchain_core.tracers.context
  • langchain_core.tracers.langchain
  • langchain_core.tracers.schemas
  • langchain_core.tracers.stdout
  • langchain_core.utils.env
  • langchain_core.utils.uuid
  • langsmith.run_helpers
  • logging
  • tenacity
  • typing
  • typing_extensions
  • uuid

Frequently Asked Questions

What does manager.py do?
manager.py is a source file in the langchain codebase, written in python. It belongs to the CoreAbstractions domain, Serialization subdomain.
What functions are defined in manager.py?
manager.py defines 13 function(s): _ahandle_event_for_handler, _configure, _executor, _get_debug, _run_coros, adispatch_custom_event, ahandle_event, atrace_as_chain_group, collections, dispatch_custom_event, and 3 more.
What does manager.py depend on?
manager.py imports 28 module(s): abc, asyncio, atexit, collections.abc, concurrent.futures, contextlib, contextvars, functools, and 20 more.
Where is manager.py in the architecture?
manager.py is located at libs/core/langchain_core/callbacks/manager.py (domain: CoreAbstractions, subdomain: Serialization, directory: libs/core/langchain_core/callbacks).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free