Skip to content

Conversation

@moonbox3
Copy link
Contributor

@moonbox3 moonbox3 commented Nov 6, 2025

Motivation and Context

The workflow code uses a separate DictConvertible class with methods like to_dict(), from_dict(), to_json(), and from_json(). These methods are also available in the core library under SerializationMixin. So the code is aligned, workflows is moving to use SerializationMixin removing the need for DictConvertible.

This is a pure internal refactoring that maintains complete backwards compatibility while standardizing the codebase on SerializationMixin. Users won't need to change any code, and all existing serialized workflows/checkpoints will continue to work. Users will have access to additional optional features like exclude and exclude_none parameters in to_dict(), which is an enhancement, and a breaking change.

Description

Contribution Checklist

  • The code builds clean without any errors or warnings
  • The PR follows the Contribution Guidelines
  • All unit tests pass, and I have added new tests where possible
  • Is this a breaking change? If yes, add "[BREAKING]" prefix to the title of the PR.

@moonbox3 moonbox3 self-assigned this Nov 6, 2025
Copilot AI review requested due to automatic review settings November 6, 2025 05:56
@moonbox3 moonbox3 added python squad: workflows Agent Framework Workflows Squad workflows Related to Workflows in agent-framework labels Nov 6, 2025
@moonbox3 moonbox3 requested review from TaoChenOSU, alliscode and eavanvalkenburg and removed request for Copilot November 6, 2025 05:56
@markwallace-microsoft
Copy link
Member

Python Test Coverage

Python Test Coverage Report •
FileStmtsMissCoverMissing
packages/core/agent_framework/_workflows
   _edge.py2192688%37, 59–60, 62, 414–415, 420, 424–429, 431–433, 543, 657, 664–666, 713, 741, 769, 823, 837
   _executor.py138695%203, 319, 334, 336, 451, 461
   _magentic.py93128269%70–79, 84, 88–99, 323, 328, 345, 347, 362, 370–379, 457, 461, 475, 483, 498, 584, 597, 614, 623–624, 626–628, 630, 641, 691, 708–712, 715–719, 799–802, 805–809, 811–813, 820, 859, 906, 942–944, 946, 1013, 1086, 1088–1089, 1097, 1123–1124, 1133, 1142–1144, 1163, 1174, 1184–1185, 1187–1188, 1207, 1260, 1280, 1283, 1311–1315, 1317, 1319, 1321, 1323–1327, 1333, 1339, 1341, 1345, 1348–1350, 1353, 1357–1358, 1361–1363, 1365, 1367, 1375–1378, 1380, 1384–1385, 1388–1391, 1393–1394, 1400–1402, 1405–1406, 1411–1412, 1420, 1428, 1443, 1455, 1467–1470, 1499–1500, 1505–1507, 1538, 1564, 1579, 1595, 1612, 1682, 1688–1689, 1703, 1705, 1708, 1710–1711, 1714–1715, 1719, 1722, 1743, 1780–1781, 1783, 1787–1789, 1805, 1816, 1826, 1870, 1875–1876, 2202–2203, 2207, 2222, 2227, 2230, 2284, 2295, 2306–2308, 2321–2322, 2327, 2338–2340, 2351–2353, 2365–2372, 2374–2375, 2383, 2391–2392, 2394–2396, 2398–2401, 2405–2413, 2417–2418, 2421–2425, 2427–2428, 2430–2433, 2435–2438, 2440–2442, 2444–2445, 2447–2449, 2464–2467, 2478–2481, 2493–2496, 2500
   _model_utils.py10550%12–16
   _workflow.py2461892%94, 263–265, 267–268, 282, 306, 308, 401, 650, 684, 689, 692, 711–713, 778
TOTAL12805190585% 

Python Unit Test Overview

Tests Skipped Failures Errors Time
1698 107 💤 0 ❌ 0 🔥 33.489s ⏱️

Copy link
Member

@eavanvalkenburg eavanvalkenburg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so made one comment, that applies to many classes, the design calls for some additional leeway in the init, that parses dicts and calls from_dict on those items, so that you do not need to subclass from_dict for each (it does the inverse OOTB in to_dict). That also ensures the dependency injection can work across the board, which will probably be usefull for declarative support down the line.


def __init__(
self,
edges: Sequence[Edge] | None = None,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so in order for the serializaiton to work OOTB into nested classes, this would need to accept Sequence[Mapping[str, Any]] and then if the type is not an Edge, it should call Edge.from_dict(), that way you do not have to customize the from_dict for each class, to handle that behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

python squad: workflows Agent Framework Workflows Squad workflows Related to Workflows in agent-framework

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Python: Implement SerializationMixin in place of DictConvertible

3 participants