Skip to content

cant reach the state with checkpoint_id #129

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
us opened this issue May 8, 2025 · 2 comments
Open

cant reach the state with checkpoint_id #129

us opened this issue May 8, 2025 · 2 comments

Comments

@us
Copy link

us commented May 8, 2025

i am trying to using checkpoint_id and thread_id to reach history in specific point.

let say history is following:

checkpoint 1
human 1
checkpoint 2
ai 1
checkpoint 3
human 2
checkpoint 4
ai 2
checkpoint 5
(i can be wrong about the checkpoints order according to langchain but its not the part of issue, its just basic graph)

so what i expect with from following

async def astream_graph(state, config):
    try:
        async with AsyncMongoDBSaver.from_conn_string(os.getenv("MONGODB_URI"),
                                                      db_name=os.getenv("MONGODB_DB_NAME")) as checkpointer:
            graph = build_graph(checkpointer)
            # print("graph.get_state_history(config)", [state for state in graph.get_state_history(config)])
            async for event in graph.astream(state, config, stream_mode=["messages", "debug", "custom"]):
                yield event
    except Exception as e:
        print(f"Error in streaming: {str(e)}")
        raise
state=... (thats ok)
config = {"thread_id": "abc", "checkpoint_id":"checkpoint 3"}
astream_graph(state, config)

i am expecting to return me history until checkpoint 3 like:

checkpoint 1
human 1
checkpoint 2
ai 1
checkpoint 3

but i am just getting full history, so it looks like checkpoint_id is not works like expected.
I am talking about that replay thing https://langchain-ai.github.io/langgraph/concepts/persistence/#replay

here my env:
python3.12

packages:
langchain==0.3.21
langgraph==0.3.20
langgraph-checkpoint-mongodb==0.1.3
langchain-core==0.3.48
langchain-openai==0.3.7

@us
Copy link
Author

us commented May 13, 2025

@blink1073 any updates?

@blink1073
Copy link
Collaborator

Hi @us, thanks for the report! I created https://jira.mongodb.org/browse/INTPYTHON-623 and assigned it to @caseyclements. I don't have a good working knowledge of the LangGraph side of things. He's at the LangChain Interrupt conference this week, so please bear with us. 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants