LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
  • Overview
    • Overview
    • Graphs
    • Functional API
    • Pregel
    • Checkpointing
    • Storage
    • Caching
    • Types
    • Runtime
    • Config
    • Errors
    • Constants
    • Channels
    • Agents
    LangGraph CLI
    LangGraph SDK
    LangGraph Supervisor
    LangGraph Swarm
    ⌘I

    LangChain Assistant

    Ask a question to get started

    Enter to send•Shift+Enter new line

    Menu

    OverviewGraphsFunctional APIPregelCheckpointingStorageCachingTypesRuntimeConfigErrorsConstantsChannelsAgents
    LangGraph CLI
    LangGraph SDK
    LangGraph Supervisor
    LangGraph Swarm
    Language
    Theme
    Pythonlanggraphpregel_executorAsyncBackgroundExecutor
    Class●Since v0.6

    AsyncBackgroundExecutor

    Copy
    AsyncBackgroundExecutor(
        self,
        config: RunnableConfig,
    )

    Bases

    AbstractAsyncContextManager

    Constructors

    Attributes

    Methods

    View source on GitHub
    constructor
    __init__
    NameType
    configRunnableConfig
    attribute
    tasks: dict[asyncio.Future, tuple[bool, bool]]
    attribute
    sentinel
    attribute
    loop
    attribute
    semaphore: asyncio.Semaphore | None
    method
    submit
    method
    done

    A context manager that runs async tasks in the background. Uses the current event loop to delegate tasks to asyncio tasks. On exit,

    • cancels any tasks with __cancel_on_exit__=True
    • waits for all tasks to finish
    • re-raises the first exception from tasks with __reraise_on_exit__=True ignoring CancelledError