Symptom
With response_format and a checkpointer, the second agent.invoke on the same thread returns the previous turn's structured response. The report expects Answer(text='Bye') and gets Answer(text='Hi'). No exception is printed.
Evidence what you'll see
- The repro queues three model replies,
Hi,BAD, andBye, withToolStrategyandhandle_errors=True. Turn 2 should consume the third reply. It returns turn 1's answer instead. - Both routing edges return the end destination when
structured_responseis merely present in state._build_commandswrites that field only when the value is not None, so nothing clears it between turns.
Why it happens
A checkpointer restores the previous turn's structured_response. The edges treated the key as proof the turn was done, including when this turn's first structured output failed validation and needed a retry. Pull request 39248 writes None when response_format is set and this call produced no value, and the edges require state.get("structured_response") is not None.
Affected versions
langchain==1.2.8, also libs/langchain_v1 1.2.15 on main, langchain-core==1.2.8, langgraph==1.0.7, langgraph-checkpoint==4.0.0, Python 3.14.4. Darwin kernel 25.4.0, arm64. The repro uses InMemorySaver and ToolStrategy.
Fix steps
0 of 2 done
Your check marks stay in this browser only.
How to check it worked
- Run two
agent.invokecalls on onethread_id, as in the report. The secondstructured_responseis that turn's answer, notAnswer(text='Hi').
If it still fails
- A comment on 5 May 2026 says
before_modelmiddleware on the next turn can still see the restored value, because the clear runs after the model node. The merged pull request does not say it clears the value at graph entry. - The linked issue does not describe a remaining early exit after pull request 39248 for the two-turn case in the report.
Sources and credit
Summarized in our own words from these public reports. Credit goes to their authors.
Provided as is, without warranty. Try changes in a non-production environment and back up first. Security-related steps: verify against the official docs. Terms · Request removal or attribution change
Hit an error we don't cover? Submit it