-
Is there a way to pass a
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
@aidin1324 this should not be done at the checkpointer level. you can change the reducer in your agent to always keep at most last N messages if you want the messages to be updated in the graph state (e.g. update you would just need to be careful to make sure the resulting message history is valid see more on reducers here https://langchain-ai.github.io/langgraph/concepts/low_level/#reducers |
Beta Was this translation helpful? Give feedback.
@aidin1324 this should not be done at the checkpointer level. you can change the reducer in your agent to always keep at most last N messages if you want the messages to be updated in the graph state (e.g. update
add_messages
in your state schema implementation https://github.com/langchain-ai/langgraph/blob/main/libs/langgraph/langgraph/graph/message.py#L266).you would just need to be careful to make sure the resulting message history is valid
see more on reducers here https://langchain-ai.github.io/langgraph/concepts/low_level/#reducers