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_algoprepare_next_tasks
    Functionā—Since v0.6

    prepare_next_tasks

    Prepare the set of tasks that will make up the next Pregel step.

    Copy
    prepare_next_tasks(
      checkpoint: Checkpoint,
      pending_writes: list[PendingWrite],
      processes: Mapping[str, PregelNode],
      channels: Mapping[str, BaseChannel],
      managed: ManagedValueMapping,
      config: RunnableConfig,
      step: int,
      stop: int,
      *,
      for_execution: bool,
      store: BaseStore | None = None,
      checkpointer: BaseCheckpointSaver | None = None,
      manager: None | ParentRunManager | AsyncParentRunManager = None,
      trigger_to_nodes: Mapping[str, Sequence[str]] | None = None,
      updated_channels: set[str] | None = None,
      retry_policy: Sequence[RetryPolicy] = (),
      cache_policy: CachePolicy | None = None
    ) -> dict[str, PregelTask] | dict[str, PregelExecutableTask]

    Parameters

    NameTypeDescription
    checkpoint*Checkpoint

    The current checkpoint.

    pending_writes*list[PendingWrite]

    The list of pending writes.

    processes*Mapping[str, PregelNode]

    The mapping of process names to PregelNode instances.

    channels*Mapping[str, BaseChannel]

    The mapping of channel names to BaseChannel instances.

    managed*ManagedValueMapping

    The mapping of managed value names to functions.

    config*RunnableConfig

    The Runnable configuration.

    step*int

    The current step.

    for_execution*bool

    Whether the tasks are being prepared for execution.

    storeBaseStore | None
    Default:None

    An instance of BaseStore to make it available for usage within tasks.

    checkpointerBaseCheckpointSaver | None
    Default:None

    Checkpointer instance used for saving checkpoints.

    managerNone | ParentRunManager | AsyncParentRunManager
    Default:None

    The parent run manager to use for the tasks.

    trigger_to_nodesMapping[str, Sequence[str]] | None
    Default:None

    Optional: Mapping of channel names to the set of nodes that are can be triggered by that channel.

    updated_channelsset[str] | None
    Default:None

    Optional. Set of channel names that have been updated during the previous step. Using in conjunction with trigger_to_nodes to speed up the process of determining which nodes should be triggered in the next step.

    View source on GitHub