Skip to content

How to pass state that uses add operator to subgraph without duplicating it? #2730

Answered by vbarda
arko-louisa asked this question in Q&A
Discussion options

You must be logged in to vote

yes, you can write a custom reducer (instead of operator.add) that assigns an ID to the answer and then deduplicates based on the IDs, something similar to add_messages reducer https://github.com/langchain-ai/langgraph/blob/main/libs/langgraph/langgraph/graph/message.py#L18

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
3 replies
@arko-louisa
Comment options

@wei-fh
Comment options

@hinthornw
Comment options

Answer selected by arko-louisa
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants