What this thread does
Do first: Upgrade the langchain package to langchain==1.3.15 or a later stable release.
Symptom
The symptom is create_agent returning a stale structured_response from a checkpoint and exiting the next turn early. jessieibarra reported this with response_format and a checkpointer: after validation fails, the previous turn’s answer is returned instead of retrying. Other users commented on the issue: truffle-dev, Kcstring.
Cause
The state update previously omitted structured_response when the call produced none, leaving the checkpoint’s old value in place. Routing treated presence of the key as completion. The merged PR clears the value to None for agents configured for structured output and routes on a non-None response.
Fix
1. Upgrade langchain, the package containing this agent-factory fix. 2. Keep the configured response_format and checkpointer: the updated _build_commands clears missing output, and the routing edges use state.get("structured_response") is not None before ending the loop.
The clearing branch and both non-None routing checks remain in langchain==1.5.2 (released 2026-11-18).
Fixed in
Fixed in langchain==1.3.15 (released 2026-08-11), the first stable package release carrying this fix. PR #39248 was merged on 2026-08-05.
If it still fails
- Clearing applies when the agent has a configured
response_formatand the current call produces no structured response. It does not make invalid model output valid; it permits the retry path instead of returning stale checkpoint output.
Not for: LangChain 0.x-to-1.x create_agent migration; see langchain-0-to-1-create-agent-langgraph-migration.
Sources
create_agent: stalestructured_responsefrom checkpoint causes premature exit on next turn, jessieibarra, opened 2026-04-22; closed as completed on 2026-08-05: "stalestructured_responsefrom checkpoint causes premature exit on next turn"- fix(langchain): clear stale
structured_responsebetween checkpointed turns, imnishitha, merged 2026-08-05. langchain==1.3.15, published 2026-08-11.langchain==1.5.2, published 2026-11-18.- Comment, truffle-dev, 2026-04-22; parent issue closed as completed on 2026-08-05.
- Comment, Kcstring, 2026-04-23; parent issue closed as completed on 2026-08-05.
- Source at the langchain==1.5.2 tag, read 2026-11-24.
Checked
2026-11-24; read the issue and linked comment API records, merged PR and changed files, listed release records, release containment comparison where listed, and source files at the named current tag; no command was run.
Started from a post by @jessieibarra, packaged by the editor. Original post