Repository navigation
Conversation
Add restore_context_types to LangGraphPlugin. Setting it to False keeps the 0.1.0 behavior: Activity nodes and tasks receive class-based contexts as decoded dictionaries, and contexts of undeclared classes are allowed. Workflows still attach schema IDs for declared classes, so turning restoration on later is a rolling deploy. Also accept context schemas that are not classes, such as dict[str, Any], which 0.1.0 accepted. Replay saved 0.1.0 histories with both settings, and document the upgrade path in the README.
campoy
commented
Oct 21, 2026
campoy
left a comment
Contributor
Author
There was a problem hiding this comment.
Move python/langgraph/CONTEXT-RESTORATION-PLAN.md to python/langgraph/docs/CONTEXT-RESTORATION-PLAN.md
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
#126 made Activity nodes and tasks rebuild class-based contexts by default. That breaks apps upgrading from 0.1.0 in three ways. I checked each by running 0.1.0 and #126 against a local server:
runtime.context["user_id"]) now fails withTypeError.context_schemanow fails the Workflow task. Workflows started on 0.1.0 fail the same way when they replay.context_schema=dict[str, Any]now fails when the plugin is created.This adds
restore_context_typestoLangGraphPlugin. The default staysTrue. WithFalse:Schemas that aren't classes are now accepted with either setting.
How compatibility holds
Not included: aliases for renamed context classes.
Testing
The 0.1.0 histories were recorded by running this branch's
TwoNodesWorkflowwith the 0.1.0 plugin source. The worker identity is replaced withrecorder.Locally, from source against a dev server with cached SDK 1.34.0 and LangGraph 1.2.9: all graph context cases, both replay tests, the Functional API context test and the validation tests pass. ruff 0.15.22, mypy 1.18.2, basedpyright 1.34.0, pydocstyle and the conventions check pass.
make lint,make testandmake buildcan't run locally because the installed uv is 0.11.21 and the repo needs >=0.12.5, so CI runs the supported matrix.