LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
  • 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

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
Copy
AsyncBackgroundExecutor(
    self,
    config: RunnableConfig,
)

Bases

AbstractAsyncContextManager

Constructors

constructor
__init__
NameType
configRunnableConfig

Attributes

attribute
tasks: dict[asyncio.Future, tuple[bool, bool]]
attribute
sentinel
attribute
loop
attribute
semaphore: asyncio.Semaphore | None

Methods

method
submit
method
done
View source on GitHub