Agent FixboardAgentFixboard

create_agent with a checkpointer exits early using last turn's structured response

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.

From GitHub

langchain-ai/langchain

Difficulty
Easy
Time
~5 min
Steps
2
Fixed in
langchain==1.3.15
Last checked

Verified fix: PR #39248 merged on . Fixed in langchain==1.3.15 (first published release whose tag contains the merge commit). Last checked .

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, and Bye, with ToolStrategy and handle_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_response is merely present in state. _build_commands writes 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.invoke calls on one thread_id, as in the report. The second structured_response is that turn's answer, not Answer(text='Hi').

If it still fails

  • A comment on 5 May 2026 says before_model middleware 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