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_readPregelNode
Class●Since v0.6

PregelNode

A node in a Pregel graph. This won't be invoked as a runnable by the graph itself, but instead acts as a container for the components necessary to make a PregelExecutableTask for a node.

Copy
PregelNode(
  self,
  *,
  channels: str | list[str],
  triggers: Sequence[str],
  mapper: Callable[[Any], Any] | None = None,
  writers: list[Runnable] | None = None,
  tags: list[str] | None = None,
  metadata: Mapping[str, Any] | None = None,
  bound: Runnable[Any, Any] | None = None,
  retry_policy: RetryPolicy | Sequence[RetryPolicy] | None = None,
  cache_policy: CachePolicy | None = None,
  subgraphs: Sequence[PregelProtocol] | None = None
)

Constructors

constructor
__init__
NameType
channelsstr | list[str]
triggersSequence[str]
mapperCallable[[Any], Any] | None
writerslist[Runnable] | None
tagslist[str] | None
metadataMapping[str, Any] | None
boundRunnable[Any, Any] | None
retry_policyRetryPolicy | Sequence[RetryPolicy] | None
cache_policyCachePolicy | None
subgraphsSequence[PregelProtocol] | None

Attributes

attribute
channels: str | list[str]

The channels that will be passed as input to bound. If a str, the node will be invoked with its value if it isn't empty. If a list, the node will be invoked with a dict of those channels' values.

attribute
triggers: list[str]

If any of these channels is written to, this node will be triggered in the next step.

attribute
mapper: Callable[[Any], Any] | None

A function to transform the input before passing it to bound.

attribute
writers: list[Runnable]

A list of writers that will be executed after bound, responsible for taking the output of bound and writing it to the appropriate channels.

attribute
bound: Runnable[Any, Any]

The main logic of the node. This will be invoked with the input from channels.

attribute
retry_policy: Sequence[RetryPolicy] | None

The retry policies to use when invoking the node.

attribute
cache_policy: CachePolicy | None

The cache policy to use when invoking the node.

attribute
tags: Sequence[str] | None

Tags to attach to the node for tracing.

attribute
metadata: Mapping[str, Any] | None

Metadata to attach to the node for tracing.

attribute
subgraphs: Sequence[PregelProtocol]

Subgraphs used by the node.

attribute
flat_writers: list[Runnable]

Get writers with optimizations applied. Dedupes consecutive ChannelWrites.

attribute
node: Runnable[Any, Any] | None

Get a runnable that combines bound and writers.

attribute
input_cache_key: INPUT_CACHE_KEY_TYPE

Get a cache key for the input to the node. This is used to avoid calculating the same input multiple times.

Methods

method
copy
method
invoke
method
ainvoke
method
stream
method
astream
View source on GitHub