Skip to content

Conversation

@eavanvalkenburg
Copy link
Member

@eavanvalkenburg eavanvalkenburg commented Jan 16, 2026

Motivation and Context

Replaced all old Content types (derived from BaseContent) to a single Content
with classmethods to create specific ones.

This gives chat client builders the option* to create custom types without having that abstracted. They can put in some other value for the type and drop any other fields into additional_propertiers.

*: this will not work for all clients, since those won't know what to do with them, but they can internally create and parse them.

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.

@eavanvalkenburg eavanvalkenburg requested a review from a team as a code owner January 16, 2026 14:45
Copilot AI review requested due to automatic review settings January 16, 2026 14:45
@eavanvalkenburg eavanvalkenburg marked this pull request as draft January 16, 2026 14:45
@markwallace-microsoft markwallace-microsoft added documentation Improvements or additions to documentation python lab Agent Framework Lab labels Jan 16, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request refactors the Content model in the Python Agent Framework, replacing the old inheritance-based Content types (derived from BaseContent) with a single Content class that uses classmethods to create specific content types. This is a significant architectural change that modernizes the content type system.

Changes:

  • Replaced multiple Content classes (TextContent, DataContent, FunctionCallContent, etc.) with a single Content class with factory methods (from_text, from_data, from_function_call, etc.)
  • Updated all code references from the old class-based approach to the new classmethod-based approach
  • Changed attribute name from details to usage_details in UsageContent
  • Updated dependency versions in uv.lock (anthropic, azure-core, huggingface-hub, identify, langfuse, librt, litellm, mem0ai, openai-agents, openai-chatkit, plotly, polars, py2docfx, regex, ruff, uv)
  • Updated TypeScript types to match the new Content structure
  • Fixed observability settings usage in lightning package

Reviewed changes

Copilot reviewed 121 out of 123 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
python/uv.lock Updated package dependency versions
python/samples (multiple files) Updated from old Content classes to new Content.from_* factory methods
python/packages (multiple test files) Updated test assertions and imports to use new Content model
python/packages/ollama Updated OllamaChatClient to use new Content type checking
python/packages/devui Updated TypeScript types and Python mapper to use new Content structure
python/packages/declarative Updated loader to use new Content factory methods
python/packages/lab/lightning Fixed observability settings API usage

@markwallace-microsoft
Copy link
Member

markwallace-microsoft commented Jan 18, 2026

Python Test Coverage

Python Test Coverage Report •
FileStmtsMissCoverMissing
packages/a2a/agent_framework_a2a
   _agent.py139794%352–353, 390–391, 420–422
packages/ag-ui/agent_framework_ag_ui
   _client.py1401192%37, 88–92, 238, 268, 423–425
   _event_converters.py690100% 
   _events.py2641395%105–106, 196, 215, 244, 258, 281, 361–362, 391, 402, 425, 481
   _message_adapters.py4524490%65, 75–76, 85–88, 154, 254, 258, 261, 264, 268, 284, 301, 323, 359, 371, 422, 439–440, 501, 505, 511, 519–520, 522, 526–529, 542, 631–634, 636, 701, 758, 762, 765, 768, 776–777
   _orchestrators.py4104888%111, 120, 227, 477, 532–534, 541–542, 550, 552–554, 558, 567, 600, 602–604, 606–609, 611, 613–614, 616, 618–625, 725–727, 731–736, 785–787, 790
   _types.py33196%12
packages/ag-ui/agent_framework_ag_ui/_orchestration
   _helpers.py1845371%57, 106, 109, 146, 149, 153, 171, 174, 178, 195, 198, 201, 221, 233, 237, 252, 257, 288–305, 307–310, 314–315, 329, 348–350, 357, 377, 379, 382–386
   _state_manager.py50198%95
packages/anthropic/agent_framework_anthropic
   _chat_client.py34213759%51, 360, 383, 385, 398, 420–423, 473–474, 483, 485–486, 491, 508–509, 551, 566, 570–571, 587, 596, 598, 602–603, 644–646, 648, 661–662, 669–671, 675–677, 681–684, 695, 697, 719, 729, 751–757, 764–765, 773–774, 782–785, 792–793, 799–800, 806–807, 813, 821–823, 827, 834–835, 841–842, 848–849, 855, 863–866, 873–874, 893, 900–901, 920, 942, 944, 953–954, 960, 982–983, 989–990, 999–1009, 1016–1022, 1029–1035, 1042–1051, 1058–1061
packages/azure-ai/agent_framework_azure_ai
   _chat_client.py4789480%377, 638–639, 641, 644, 647, 650–655, 658, 660, 668, 680–682, 686, 689–690, 698–701, 711, 719–722, 724–725, 727–728, 735, 743–744, 752–753, 758–759, 763–770, 775, 778, 786, 792, 800–802, 805, 827–828, 938, 940, 942, 957, 985, 998–1002, 1041–1043, 1046–1047, 1093–1099, 1121, 1147, 1156, 1165, 1167, 1172, 1181–1186, 1298
   _client.py1874377%250–253, 258, 261–264, 269, 272–273, 276, 283, 393, 420–423, 466, 503, 505, 510, 512–513, 516–519, 521, 523–524, 526–534, 536, 581
   _shared.py29611860%100–101, 104–106, 109–114, 116, 147, 149, 151, 153, 198, 286–289, 292–294, 297–298, 308, 315–317, 343–352, 357, 405, 421–423, 425–442, 450–453, 458–459, 463–470, 475–476, 482–484, 487–488, 490, 502, 504–505, 508–511, 514, 516–517, 519–527, 529, 565, 567–570, 572, 578, 584, 588, 603, 606–607, 609
packages/azurefunctions/agent_framework_azurefunctions
   _durable_agent_state.py45913071%65, 72–73, 93–94, 120–122, 139, 149–150, 157–158, 166–167, 175–176, 183–184, 190–191, 197–198, 202–203, 210–213, 219, 221, 255, 266, 284, 288, 290, 292, 294, 297–303, 346, 409, 420–421, 430–433, 435, 461–462, 465, 467, 472, 531–532, 534, 592, 664, 675, 746, 748, 825, 828, 850–851, 854, 862, 865, 892, 906, 929–931, 934, 944–948, 950–953, 955, 958, 979–980, 983, 991, 994, 1012, 1015, 1019, 1022, 1041, 1044, 1053, 1056, 1098, 1101, 1105, 1108, 1128–1129, 1132, 1140, 1143, 1178, 1183–1185, 1189, 1200, 1208, 1231, 1234, 1241, 1244, 1263, 1266, 1270, 1273–1275
   _entities.py1812188%137, 177–178, 229, 237, 242–243, 270–271, 280, 287, 298, 304–305, 324–325, 395, 427–429, 431
packages/chatkit/agent_framework_chatkit
   _converter.py1354765%33, 116, 121, 169, 171, 341, 394, 396, 415–417, 419, 437, 439, 441, 444, 456, 466, 484, 504–528, 530–532
   _streaming.py270100% 
packages/copilotstudio/agent_framework_copilotstudio
   _agent.py75494%154–155, 190, 198
packages/core/agent_framework
   _agents.py2975481%51, 90, 96, 99, 102, 404–406, 452, 634, 803, 806–808, 925–928, 930, 933–935, 1036, 1077, 1079, 1088–1093, 1099, 1101, 1111–1112, 1119, 1121–1122, 1130–1134, 1142–1143, 1145, 1150, 1152, 1186, 1231–1232, 1234, 1236, 1247
   _mcp.py3776183%111, 173, 182, 245, 253, 274, 364, 386–389, 399, 434, 436, 440–441, 443–444, 447–448, 451–452, 498, 513, 531, 572, 678, 691–696, 718, 733, 736–738, 753–754, 760–762, 781, 790, 793–795, 810–811, 815–819, 836–840, 980
   _tools.py7587490%226, 272, 323, 325, 353, 523, 555–556, 658, 660, 680, 698, 712, 724, 729, 731, 738, 771, 827–829, 870, 895–904, 910–919, 955, 965, 1206, 1543, 1629–1633, 1758, 1760, 1826, 1918, 1924, 1966–1967, 1980–1981, 2024, 2108, 2146–2147, 2175–2177, 2215–2216, 2226, 2283–2284, 2291–2292
   _types.py94712886%72, 95–96, 150, 155, 174, 176, 180, 184, 186, 188, 190, 207–208, 210–212, 214–215, 217–218, 220–221, 236–238, 240–243, 260, 265, 270, 274, 300, 304, 648–649, 1020, 1082, 1099, 1117, 1122, 1140, 1148–1150, 1167–1168, 1170, 1188–1189, 1191, 1198–1199, 1201, 1236, 1247–1248, 1250, 1269–1270, 1273–1282, 1285–1288, 1290, 1294, 1328, 1361, 1533, 1538, 1542, 1546, 1738, 1748, 1793, 1838–1843, 1865, 1870, 2229, 2238, 2374, 2462–2464, 2503, 2559, 2580, 2589, 2818–2820, 2823–2825, 2829, 2834, 2838, 2950–2952, 2980, 3016, 3034, 3038–3040, 3042, 3053–3054, 3059, 3067
   observability.py62514476%244, 312–317, 319, 321–322, 324, 326–328, 331–333, 338–339, 345–346, 352–353, 360, 362–364, 367–369, 374–375, 381–382, 388–389, 396, 433, 436, 439–441, 444, 447–448, 451–453, 455–457, 460, 547, 549, 631, 649–650, 652, 655, 663–664, 667–670, 672, 675–677, 680–681, 694–700, 702–711, 714–718, 721–724, 726–729, 732–733, 741, 842, 844, 869–871, 993, 995, 999–1004, 1006, 1009–1013, 1015, 1290, 1374–1376, 1449–1451, 1615, 1618, 1677, 1761, 1763, 1770, 1786, 1789, 1849, 1865, 1869, 2003, 2005
packages/core/agent_framework/_workflows
   _agent.py2784583%56, 64–70, 98–99, 255, 311, 325, 338, 387–390, 396, 402, 406–407, 410–416, 420–421, 490, 497, 503–504, 515, 547, 554, 575, 584, 588, 590–592, 599
   _agent_executor.py1722486%27, 94, 116, 150, 166–167, 218–219, 221–222, 254–256, 264–266, 276–278, 280, 284, 288, 292–293
   _orchestrator_helpers.py21290%90–91
packages/core/agent_framework/azure
   _chat_client.py79494%282, 284, 297–298
packages/core/agent_framework/openai
   _assistants_client.py2803587%60, 353, 367, 370, 372–373, 376, 379, 382–383, 394, 419, 421, 423, 425, 427, 432, 435, 438, 442, 453, 538, 557–558, 563, 571, 623, 658, 695–698, 750, 767, 812
   _chat_client.py2685280%44, 178–179, 183, 202, 204, 222, 230, 239, 244, 249, 255, 260–261, 264, 269, 273–274, 276, 294, 314, 337, 351, 356–370, 377–379, 454, 460, 464, 467, 469, 471, 480, 494–495, 501, 517
   _responses_client.py56011878%250, 255, 257–258, 269, 287, 295, 298–305, 307, 311–312, 314–323, 329, 334–338, 340–341, 343, 380, 412, 437, 443, 461–462, 484, 489, 542, 545, 559, 576, 589, 640, 719, 724, 728–730, 734–735, 758, 773–774, 778–780, 827, 849–850, 865–866, 884–885, 974–975, 984–985, 1016–1017, 1033, 1035, 1110–1118, 1141–1147, 1166, 1184–1185, 1194, 1199–1201, 1207–1208, 1221, 1236, 1272–1273, 1275–1277, 1291–1293, 1303–1304, 1310, 1325
TOTAL17426270284% 

Python Unit Test Overview

Tests Skipped Failures Errors Time
3171 213 💤 0 ❌ 0 🔥 1m 1s ⏱️

@eavanvalkenburg eavanvalkenburg marked this pull request as ready for review January 19, 2026 13:27
@eavanvalkenburg eavanvalkenburg changed the title Python: ported Content to a new model Python: [Breaking] Simplified Content types to a single class with classmethod constructors. Jan 19, 2026
@eavanvalkenburg eavanvalkenburg added this pull request to the merge queue Jan 20, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jan 20, 2026
@eavanvalkenburg eavanvalkenburg added this pull request to the merge queue Jan 20, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jan 20, 2026
@eavanvalkenburg eavanvalkenburg added this pull request to the merge queue Jan 20, 2026
Merged via the queue into microsoft:main with commit 83e6229 Jan 20, 2026
35 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation lab Agent Framework Lab python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants