Repository navigation
Python: [Bug]: SerializationMixin does not recursively serialize nested containers #7788
Copy link
Copy link
Closed
Copy link
Labels
agentsUsage: [Issues, PRs], Target: Single agentUsage: [Issues, PRs], Target: Single agentpythonUsage: [Issues, PRs], Target: PythonUsage: [Issues, PRs], Target: PythonreproducedUsage: [Issues], Target: all issues that can be reproduced by the triage workflowUsage: [Issues], Target: all issues that can be reproduced by the triage workflow
Description
Activity
- addedpythonUsage: [Issues, PRs], Target: PythonUsage: [Issues, PRs], Target: PythontriageUsage: [Issues], Target: All issues that still need to be triagedUsage: [Issues], Target: All issues that still need to be triaged
on Aug 20, 2026 - addedreproducedUsage: [Issues], Target: all issues that can be reproduced by the triage workflowUsage: [Issues], Target: all issues that can be reproduced by the triage workflow
on Aug 21, 2026 github-actions commented
on Aug 21, 2026 on Aug 21, 2026 – with GitHub ActionsContributorMore actions🤖 Automated triage reproduction notes (agent-authored — trust but verify)
Agent analysis
Repro:
python/packages/core/agent_framework/_serialization.py::SerializationMixin.to_dictat lines 345-389 stops traversing when a list or dictionary contains another container, andto_jsonfails at line 416. Trigger it with aSerializationMixinattribute shaped asdict -> list -> dict -> list -> SerializationMixin; the focused test constructs that shape and observesTypeError: Object of type Item is not JSON serializable.- Failing test:
python/packages/core/tests/core/test_serializable_mixin.py::TestSerializationMixin::test_to_json_with_serialization_protocol_in_nested_containers - Files examined: python/packages/core/agent_framework/_serialization.py, python/packages/core/tests/core/test_serializable_mixin.py, python/packages/core/pyproject.toml, python/pyproject.toml
- Tests run: test_to_json_with_serialization_protocol_in_nested_containers, test_to_dict_with_list_of_serialization_protocol, test_to_dict_with_dict_containing_serialization_protocol
- Reported version:
1.14.0 - Current version:
1.14.0
- Failing test:
- addedagentsUsage: [Issues, PRs], Target: Single agentUsage: [Issues, PRs], Target: Single agentand removedtriageUsage: [Issues], Target: All issues that still need to be triagedUsage: [Issues], Target: All issues that still need to be triaged
on Aug 21, 2026
Metadata
Metadata
Labels
agentsUsage: [Issues, PRs], Target: Single agentUsage: [Issues, PRs], Target: Single agentpythonUsage: [Issues, PRs], Target: PythonUsage: [Issues, PRs], Target: PythonreproducedUsage: [Issues], Target: all issues that can be reproduced by the triage workflowUsage: [Issues], Target: all issues that can be reproduced by the triage workflow
Type
Projects
- StatusShow more project fieldsDone
Description
SerializationMixin.to_dict()serializes framework objects when they are direct list items or dictionary values, but it stops after one container level. ASerializationProtocolobject nested inside a combination such asdict -> list -> dictremains in the returned mapping. As a result,SerializationMixin.to_json()raisesTypeErrorfor otherwise supported nested state.Expected: supported objects are recursively converted at any list/dictionary depth, while unsupported values keep the existing behavior of being skipped.
Actual: nested supported objects are returned unchanged and cannot be JSON encoded.
Code Sample
Error Messages / Stack Traces
Package Versions
agent-framework-core: 1.14.0and currentmain(ab6c4d2dc8573071d7f73fd8c94a8cb15a2c78a2)Python Version
Python 3.12.14
Additional Context
The same behavior occurs for
list -> dictand deeper nested dictionaries. Direct list items and direct dictionary values already serialize correctly.