Home / Function/ _executor() — langchain Function Reference

_executor() — langchain Function Reference

Architecture documentation for the _executor() function in manager.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  b6fa5ae5_9068_5835_a03e_de8794654469["_executor()"]
  35cf5db6_bcb1_b854_6ebb_5e0368e51b58["manager.py"]
  b6fa5ae5_9068_5835_a03e_de8794654469 -->|defined in| 35cf5db6_bcb1_b854_6ebb_5e0368e51b58
  5f1ef1a4_367e_0b7d_0d39_cf428c8a367e["handle_event()"]
  5f1ef1a4_367e_0b7d_0d39_cf428c8a367e -->|calls| b6fa5ae5_9068_5835_a03e_de8794654469
  style b6fa5ae5_9068_5835_a03e_de8794654469 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/langchain_core/callbacks/manager.py lines 2675–2687

def _executor() -> ThreadPoolExecutor:
    # If the user is specifying ASYNC callback handlers to be run from a
    # SYNC context, and an event loop is already running,
    # we cannot submit the coroutine to the running loop, because it
    # would result in a deadlock. Instead we have to schedule them
    # on a background thread. To avoid creating & shutting down
    # a new executor every time, we use a lazily-created, shared
    # executor. If you're using regular langgchain parallelism (batch, etc.)
    # you'd only ever need 1 worker, but we permit more for now to reduce the chance
    # of slowdown if you are mixing with your own executor.
    cutie = ThreadPoolExecutor(max_workers=10)
    atexit.register(cutie.shutdown, wait=True)
    return cutie

Subdomains

Called By

Frequently Asked Questions

What does _executor() do?
_executor() is a function in the langchain codebase, defined in libs/core/langchain_core/callbacks/manager.py.
Where is _executor() defined?
_executor() is defined in libs/core/langchain_core/callbacks/manager.py at line 2675.
What calls _executor()?
_executor() is called by 1 function(s): handle_event.

Analyze Your Own Codebase

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

Try Supermodel Free