Description
When serializing workflow state to a checkpoint, we use two reserved keywords (__af_dataclass__ and __af_model__) to achieve polymorphic serialization.
However, we don't check for if these reserved keywords are present in objects that neither dataclasses nor Pydantic models. This leads to potential issue during deserialization where we'd mistakenly deserialize a Json into an incorrect type. We also don't check if a class is really a dataclass or a Pydantic model during deserialization.
Implement fixes for:
- Do not allow values to contain the reserved keyword during serialization.
- Check if a class is really a dataclass or a Pydantic model during deserialization.
Related modules
https://github.com/microsoft/agent-framework/blob/main/python/packages/core/agent_framework/_workflows/_checkpoint_encoding.py
Package Versions
agent-framework-core
Python Version
No response
Additional Context
No response