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 Checkpoint
    Checkpoint Postgres
    Store Postgres
    Checkpoint SQLite
    LangGraph Prebuilt
    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 Checkpoint
    Checkpoint Postgres
    Store Postgres
    Checkpoint SQLite
    LangGraph Prebuilt
    LangGraph CLI
    LangGraph SDK
    LangGraph Supervisor
    LangGraph Swarm
    Language
    Theme
    Pythonlanggraphstream_typesStreamTransformerschedule
    Method●Since v1.1

    schedule

    Copy
    schedule(
      self,
      coro: Coroutine[Any, Any, Any],
      *,
      on_error: Literal
    View source on GitHub
    [
    'log'
    ,
    'raise'
    ]
    =
    'log'
    )
    ->
    asyncio
    .
    Task
    [
    Any
    ]

    Parameters

    NameTypeDescription
    coro*Coroutine[Any, Any, Any]
    on_errorLiteral['log', 'raise']
    Default:'log'

    Schedule a coroutine tied to this transformer's lifecycle.

    The mux holds the task reference, awaits all scheduled tasks during aclose() before calling afinalize(), and cancels them on afail(). Authors don't need to track tasks or implement the last-task-closes-the-log dance.

    Requires a running event loop — call only under astream(). Set requires_async = True on the class so registration under sync stream() fails fast with a clear message.

    The coroutine to run. Its lifecycle is owned by the mux from this point on.

    "log" (default) catches and logs any exception the coroutine raises, so a single failure doesn't tear down the run. "raise" lets the exception propagate when the mux joins pendings, converting the close path into the fail path.