@@ -427,6 +427,39 @@ class Record(BaseModel):
427427 assert set (parsed ["tags" ]) == {"python" , "sdk" }
428428 assert result .result_type == "success"
429429
430+ def test_plain_dict_with_non_primitive_fields_is_serialized (self ):
431+ from datetime import date , datetime , time
432+ from decimal import Decimal
433+ from enum import Enum
434+ from uuid import UUID
435+
436+ class Status (Enum ):
437+ ACTIVE = "active"
438+
439+ result = _normalize_result (
440+ {
441+ "id" : UUID ("12345678-1234-5678-1234-567812345678" ),
442+ "created" : datetime (2026 , 1 , 15 , 10 , 30 , 0 ),
443+ "day" : date (2026 , 1 , 15 ),
444+ "at" : time (10 , 30 , 0 ),
445+ "score" : Decimal ("99.5" ),
446+ "status" : Status .ACTIVE ,
447+ "tags" : {"python" , "sdk" },
448+ }
449+ )
450+ parsed = json .loads (result .text_result_for_llm )
451+ assert parsed == {
452+ "id" : "12345678-1234-5678-1234-567812345678" ,
453+ "created" : "2026-01-15T10:30:00" ,
454+ "day" : "2026-01-15" ,
455+ "at" : "10:30:00" ,
456+ "score" : "99.5" ,
457+ "status" : "active" ,
458+ "tags" : parsed ["tags" ],
459+ }
460+ assert set (parsed ["tags" ]) == {"python" , "sdk" }
461+ assert result .result_type == "success"
462+
430463 def test_raises_for_unserializable_value (self ):
431464 # Functions cannot be JSON serialized
432465 with pytest .raises (TypeError , match = "Failed to serialize" ):
0 commit comments