-
I was previously on version 0.30 and I could get the final graph state for a StateGraph by doing: async for event in parent_runnable.astream_events(version="v1"):
if event["event"] == "on_chain_end" and event["name"] == "langgraph_graph":
output = event["data"]["output"]
if not output:
final_state = output.get("__end__", {}) However, now that I updated to the last version, it seems like the final event is triggered by the penultimate node (not the end node) and the final state is no longer available? How can I access the final state when the graph is done executing? |
Beta Was this translation helpful? Give feedback.
Answered by
nfcampos
May 31, 2024
Replies: 1 comment
-
You can use stream_mode=values to get a stream of state values at the end of each step. The last of these will be the final state.
|
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
nfcampos
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can use stream_mode=values to get a stream of state values at the end of each step. The last of these will be the final state.