agentune
agentune copied to clipboard
Establish standardized serialization pattern with cattrs
Currently, we don't have a standardized approach for JSON serialization/deserialization in the project. Additionally, time-related fields use float types with implicit units, creating ambiguity.
From PR #7 discussion:
- Need to establish a pattern for using cattrs converter with proper hooks
duration_seconds: float = 0.0- the field name suggests seconds but the type doesn't enforce it- Return types like "float seconds" are unclear
Solution
1. Establish standardized cattrs serialization pattern
- Create a serialization/utils package with a module that initializes the converter
- Add all required hooks for proper JSON serialization/deserialization
- Establish this as the standard pattern for the project
2. Fix time handling as part of the standardization
- Replace
duration_seconds: floatwithduration: timedelta - Change method return types from
float(seconds) totimedelta - Add cattrs hooks for proper timedelta serialization
- Update call sites to use new field names
@danarmak I think I've fixed some of the issues, so test description is not accurate
Classes that need to be serializable - Conversation, Outcome/Outcomes, SimulationSessionResult (and all it's content)