Example: using Postgres checkpointer
checkpointer.setup()
the first time you’re using Postgres checkpointerExample: using Postgres store
store.setup()
the first time you’re using Postgres storeLong-term memory with semantic search
strategy
(e.g., keep the last maxTokens
) to use for handling the boundary.
To trim message history, use the trimMessages
function:
Full example: trim messages
RemoveMessage
. For RemoveMessage
to work, you need to use a state key with messagesStateReducer
reducer, like MessagesZodState
.
To remove specific messages:
user
messageassistant
messages with tool calls to be followed by corresponding tool
result messages.Full example: delete messages
MessagesZodState
to include a summary
key:
summarizeConversation
node can be called after some number of messages have accumulated in the messages
state key.
Full example: summarize messages