LangGraph 1 · Building graphs

Add a node

A node is a function that takes the state and returns the parts of it to update.

def chatbot(state: State):
    return {"messages": [model.invoke(state["messages"])]}

builder.add_node("chatbot", chatbot)

Official LangGraph 1 documentation

More building graphs commands

All building graphs commands · LangGraph 1 cheatsheet

Was this page helpful?