Skip to content

Accessing Graph state on GraphRecursionError #674

Answered by hinthornw
balvisio asked this question in Q&A
Discussion options

You must be logged in to vote

If I were doing this, I would fetch the state from the last checkpoint:

graph = builder.compile(checkpointer=...)
config = {"configurable": {"thread_id": "abcd123"}}
try:
    res = self.graph.invoke({"query": query}, config={"recursion_limit": 1, **config})
except GraphRecursionError:
    # I want to read the state here
    logger.exception(f"The invocation to graph reached the recursion limit")
    state = self.graph.get_state(config)

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@balvisio
Comment options

Answer selected by balvisio
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants