LangGraph does not preserve additional object fields during Flow state propagation
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 421
- Forks
- 60
- Avg merge
- 9h 30m
- Merged PRs (30d)
- 4
Description
Summary
The LangGraph runtime does not preserve dynamically added fields when an object-valued state is passed through multiple sequential ToolNodes.
The same Agent Spec flow behaves correctly in Wayflow but loses additional state fields in LangGraph.
Declared schema
{
"type": "object",
"properties": {
"counter": {
"type": "integer"
},
"trace": {
"type": "array",
"items": {
"type": "string"
}
}
},
"required": ["counter", "trace"],
"additionalProperties": true
}
Input
{
"state": {
"counter": 0,
"trace": []
}
}
State transformations
Step 1
counter = counter + 1
trace += ["step1"]
state["step1"] = "initialized"
Step 2
counter = counter + 10
trace += ["step2"]
state["step2"] = "enriched"
Step 3
counter = counter + 100
trace += ["step3"]
state["step3"] = "finalized"
Expected output
Because the schema specifies "additionalProperties": true, all dynamically added fields should be preserved:
{
"state": {
"counter": 111,
"trace": ["step1", "step2", "step3"],
"step1": "initialized",
"step2": "enriched",
"step3": "finalized"
}
}
Actual LangGraph output
{
"state": {
"counter": 111,
"trace": ["step1", "step2", "step3"],
"step3": "finalized"
}
}
The fields step1 and step2 are lost during state propagation or output conversion.
The declared fields counter and trace are propagated correctly.
Runtime comparison
| Runtime | Result |
|---|---|
| Wayflow | Passes and preserves all state fields |
| LangGraph | Fails and drops step1 and step2 |
Wayflow returns:
{
"state": {
"counter": 111,
"trace": ["step1", "step2", "step3"],
"step1": "initialized",
"step2": "enriched",
"step3": "finalized"
}
}
LangGraph returns:
{
"state": {
"counter": 111,
"trace": ["step1", "step2", "step3"],
"step3": "finalized"
}
}
Impact
Flows using extensible object-valued state can lose fields when executed with the LangGraph runtime.
This produces inconsistent behavior between LangGraph and Wayflow for the same Agent Spec and may cause downstream nodes or consumers to receive incomplete state.
Expected behavior
LangGraph should preserve additional object properties when the declared schema allows them through:
"additionalProperties": true
The state should remain cumulative and should not lose fields added by intermediate nodes.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the sequential ToolNode state-propagation path in the LangGraph runtime and reproduce the three-step example from the issue, comparing it with the Wayflow result. Trace where object-valued state is propagated or converted, then verify that fields added at steps 1 and 2 remain alongside the declared fields in the expected output.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100