A newer version of the Gradio SDK is available:
6.5.1
Bug Fix: LangGraph msgpack Serialization Error
Problem
The application was crashing with the error:
Type is not msgpack serializable: Progress
This occurred when LangGraph attempted to serialize the workflow state for checkpointing after the citation node completed.
Root Cause
The Gradio Progress object was being added to the LangGraph state dictionary:
# app.py line 460 (old)
initial_state["progress"] = progress
LangGraph uses msgpack for state serialization (required for checkpointing), but msgpack cannot serialize Gradio's Progress object since it's a complex Python object with methods and internal state.
Solution
Changes Made
Removed Progress from State Schema (
utils/langgraph_state.py)- Removed
progress: Optional[Any]field fromAgentStateTypedDict - Removed
"progress": Nonefromcreate_initial_state()return value
- Removed
Removed Progress from State Initialization (
app.py)- Removed line:
initial_state["progress"] = progress - Added comment explaining why Progress is not in state
- Removed line:
Removed Progress Checks from Nodes (
orchestration/nodes.py)- Removed all
if state.get("progress"):checks from:retriever_node()analyzer_node()synthesis_node()citation_node()
- Removed all
Removed Legacy Node Methods (
app.py)- Removed unused methods that were checking for progress in state:
_retriever_node()_filter_low_confidence_node()_synthesis_node()_citation_node()
- Removed unused methods that were checking for progress in state:
Why This Works
- Progress stays functional: The
progressobject is still passed torun_workflow()and used locally (lines 407, 425, 438 in app.py) - State stays serializable: LangGraph can now serialize the state using msgpack since it only contains serializable types
- No loss of functionality: Progress updates still work via local variable usage in
run_workflow() - Backward compatible: The fix doesn't break any existing functionality
Architecture Principle
LangGraph State Rule: Only store msgpack-serializable data in LangGraph state:
- β Primitives: str, int, float, bool, None
- β Collections: list, dict
- β Pydantic models (serializable via .model_dump())
- β Complex objects: Gradio components, file handles, thread objects, callbacks
For UI components like Gradio Progress, pass them as function parameters or use them in the orchestration layer, not in the state dictionary.
Testing
The fix should resolve the error and allow the workflow to complete successfully. To verify:
- Run the application:
python app.py - Submit a research query
- Verify the workflow completes without "Type is not msgpack serializable" error
- Verify progress updates still appear in the Gradio UI
- Check that results are properly cached and displayed
Deployment Compatibility
This fix works for both:
- β Local development (tested)
- β Hugging Face Spaces (msgpack serialization is consistent across platforms)
No environment-specific changes needed.