A graph whose nodes communicate by reading and writing to a shared state.
The signature of each node is State -> Partial<State>.
Each state key can optionally be annotated with a reducer function that
will be used to aggregate the values of that key received from multiple nodes.
The signature of a reducer function is (Value, Value) -> Value.
StateGraph is a builder class and cannot be used directly for execution.
You must first call .compile() to create an executable graph that supports
methods like invoke(), stream(), astream(), and ainvoke(). See the
CompiledStateGraph documentation for more details.
A StateGraph where every node receives a list of messages as input and returns one or more messages as output.
MessageGraph is a subclass of StateGraph whose entire state is a single, append-only* list of messages.
Each node in a MessageGraph takes a list of messages as input and returns zero or more
messages as output. The add_messages function is used to merge the output messages from each node
into the existing list of messages in the graph's state.