Skip to content

I just updated langgraph. When using astream_events, how do I get the final graph state after the graph is done executing? #562

Closed Answered by nfcampos
ldorigo asked this question in Q&A
Discussion options

You must be logged in to vote

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.

async for event in parent_runnable.astream_events(version="v1", stream_mode="values"):          
    if event["event"] == "on_chain_end" and event["name"] == "langgraph_graph":
        final_state = event["data"]["output"]

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by nfcampos
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