Skip to content

Conversation

@giles17
Copy link
Contributor

@giles17 giles17 commented Feb 9, 2026

Motivation and Context

Standardizes TypeVar naming across the Python codebase to use suffix T instead of prefix T, aligning with common Python conventions.

Notable renames

Original New Reason
TResponseModel ResponseModelT Standard rename
TResponseModelT ResponseModelBoundT Avoided collision (different constraints)
TAgentRunResponse AgentResponseT Simplified to match bound class name

Resolves #3594

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.

@giles17 giles17 requested a review from a team as a code owner February 9, 2026 18:23
Copilot AI review requested due to automatic review settings February 9, 2026 18:23
@github-actions github-actions bot changed the title [BREAKING] Standardize TypeVar naming convention (TName → NameT) Python: [BREAKING] Standardize TypeVar naming convention (TName → NameT) Feb 9, 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 PR standardizes Python TypeVar naming across the Agent Framework to use a ...T suffix instead of a T... prefix, aligning typing identifiers across core, provider packages, tests, and samples (resolving #3594).

Changes:

  • Renamed TypeVars throughout Python packages (core + integrations) to the NameT/NameBoundT/OptionsCoT style.
  • Updated affected generics/overloads/annotations in core typing surfaces (_types.py, _clients.py, middleware/layers) and downstream provider packages to match.
  • Updated samples/tests to import and use the renamed TypeVars (plus a small pyright-import suppression tweak in an OTel sample).

Reviewed changes

Copilot reviewed 40 out of 40 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
python/samples/getting_started/observability/configure_otel_providers_with_parameters.py Adds pyright suppression for optional OTLP exporter imports in the sample.
python/samples/getting_started/chat_client/custom_chat_client.py Updates sample generics to use renamed options TypeVar.
python/packages/purview/agent_framework_purview/_models.py Renames TypeVar used for _AliasSerializable helper typing.
python/packages/ollama/agent_framework_ollama/_chat_client.py Renames response/options TypeVars used by Ollama chat client/options.
python/packages/github_copilot/agent_framework_github_copilot/_agent.py Renames agent options TypeVar and updates method signatures accordingly.
python/packages/foundry_local/agent_framework_foundry_local/_foundry_local_client.py Renames response/options TypeVars used by Foundry Local client/options.
python/packages/durabletask/tests/test_durable_entities.py Renames test TypeVar used for entity state typing.
python/packages/devui/tests/devui/conftest.py Updates test mocks to use renamed options TypeVar.
python/packages/declarative/agent_framework_declarative/_models.py Renames connection/tool TypeVars used by serialization helpers.
python/packages/core/tests/core/conftest.py Updates core test mock chat client generics to renamed options TypeVar.
python/packages/core/agent_framework/openai/_responses_client.py Renames response-format/options TypeVars for OpenAI Responses client.
python/packages/core/agent_framework/openai/_chat_client.py Renames response/options TypeVars for OpenAI Chat client.
python/packages/core/agent_framework/openai/_assistants_client.py Renames response/options TypeVars for OpenAI Assistants client.
python/packages/core/agent_framework/openai/_assistant_provider.py Renames provider options TypeVar for typed ChatAgent[...] returns.
python/packages/core/agent_framework/observability.py Renames TypeVars used by telemetry layers and related overloads.
python/packages/core/agent_framework/azure/_responses_client.py Renames Azure Responses options TypeVar.
python/packages/core/agent_framework/azure/_chat_client.py Renames Azure Chat response/options/client TypeVars.
python/packages/core/agent_framework/azure/_assistants_client.py Renames Azure Assistants options TypeVar.
python/packages/core/agent_framework/_workflows/_model_utils.py Renames model TypeVar used by workflow dict/json conversion helpers.
python/packages/core/agent_framework/_types.py Renames many core TypeVars (responses/content/stream generics) and updates exports.
python/packages/core/agent_framework/_tools.py Renames TypeVars used by tool layers and overloads.
python/packages/core/agent_framework/_threads.py Renames thread/store TypeVars used by (de)serialization classmethods.
python/packages/core/agent_framework/_serialization.py Renames protocol/class TypeVars used in serialization helpers.
python/packages/core/agent_framework/_pydantic.py Renames settings TypeVar used for AFBaseSettings.__new__ typing.
python/packages/core/agent_framework/_middleware.py Renames middleware TypeVars (context/update/options) used by layers and helpers.
python/packages/core/agent_framework/_clients.py Renames client protocol/base client TypeVars (options, input, response model bound).
python/packages/core/agent_framework/_agents.py Renames agent TypeVars (thread/options/response-model bound) used in agent typing/overloads.
python/packages/claude/agent_framework_claude/_agent.py Renames agent options TypeVar and updates method signatures accordingly.
python/packages/bedrock/agent_framework_bedrock/_chat_client.py Renames response/options TypeVars used by Bedrock chat client/options.
python/packages/azurefunctions/tests/test_entities.py Renames test TypeVar used for decorator/function typing.
python/packages/azurefunctions/tests/test_app.py Renames test TypeVar used for decorator/function typing.
python/packages/azure-ai/agent_framework_azure_ai/_project_provider.py Renames provider options TypeVar for typed ChatAgent[...] returns.
python/packages/azure-ai/agent_framework_azure_ai/_client.py Renames Azure AI client options TypeVar and updates derived generics.
python/packages/azure-ai/agent_framework_azure_ai/_chat_client.py Renames Azure AI agent options TypeVar and updates as_agent typing.
python/packages/azure-ai/agent_framework_azure_ai/_agent_provider.py Renames provider options TypeVar for typed ChatAgent[...] returns.
python/packages/anthropic/agent_framework_anthropic/_chat_client.py Renames response/options TypeVars used by Anthropic client/options.
python/packages/ag-ui/tests/ag_ui/conftest.py Updates AG-UI test stubs to use renamed options TypeVar.
python/packages/ag-ui/agent_framework_ag_ui_examples/agents/ui_generator_agent.py Renames example options TypeVar used for agent factory typing.
python/packages/ag-ui/agent_framework_ag_ui/_types.py Renames AG-UI options/response TypeVars used by AG-UI TypedDict options.
python/packages/ag-ui/agent_framework_ag_ui/_client.py Renames client/options TypeVars and decorator TypeVar used by AG-UI client.

@markwallace-microsoft
Copy link
Member

markwallace-microsoft commented Feb 9, 2026

Python Test Coverage

Python Test Coverage Report •
FileStmtsMissCoverMissing
packages/ag-ui/agent_framework_ag_ui
   _client.py1511788%85–86, 90–94, 98–102, 265, 297, 466–468
   _types.py360100% 
packages/anthropic/agent_framework_anthropic
   _chat_client.py36415058%373, 405, 407, 422, 444–447, 456, 458, 495–499, 501, 503–504, 506, 511–512, 514, 547–548, 557, 559–560, 565, 582–583, 625, 640, 644–645, 661, 670, 672, 676–677, 720–722, 724, 737–738, 745–747, 751–753, 757–760, 771, 773, 795, 805, 827–833, 840–841, 849–850, 858–861, 868–869, 875–876, 882–883, 889, 897–899, 903, 910–911, 917–918, 924–925, 931, 939–942, 949–950, 969, 976–977, 996, 1018, 1020, 1029–1030, 1036, 1058–1059, 1065–1066, 1075–1085, 1092–1098, 1105–1111, 1118–1127, 1134–1137
packages/azure-ai/agent_framework_azure_ai
   _agent_provider.py116397%124–125, 253
   _chat_client.py4857584%384, 389–390, 392–393, 396, 399, 401, 406, 667–668, 670, 673, 676, 679–684, 687, 689, 697, 709–711, 715, 718–719, 727–730, 740, 748–751, 753–754, 756–757, 764, 772–773, 781–782, 787–788, 792–799, 804, 807, 815, 821, 829–831, 834, 856–857, 990, 1018, 1033, 1152, 1178, 1187, 1196, 1329
   _client.py1961393%362, 364, 413, 442–447, 490, 525, 527, 603
   _project_provider.py116694%134–135, 213, 311, 355, 388
packages/core/agent_framework
   _agents.py3213589%475, 887, 923, 1022–1024, 1137, 1178, 1180, 1189–1194, 1200, 1202, 1212–1213, 1220, 1222–1223, 1231–1235, 1243–1244, 1246, 1251, 1253, 1287, 1327, 1347
   _clients.py53394%296, 497, 499
   _middleware.py3291695%80, 83, 88, 797, 799, 801, 922, 949, 951, 976, 1057, 1061, 1185, 1189, 1250, 1324
   _pydantic.py260100% 
   _serialization.py106496%518, 534, 544, 612
   _threads.py137397%345, 476–477
   _tools.py7898589%232, 278, 329, 331, 359, 529, 564–565, 667, 669, 689, 707, 721, 733, 738, 740, 747, 780, 851–853, 894, 916–944, 979, 987, 1228, 1462, 1519, 1523, 1602–1606, 1624, 1626–1627, 1732, 1736, 1786, 1788, 1804, 1806, 1870, 1897, 1950, 2018, 2197–2198, 2225, 2233, 2246, 2256–2257, 2292, 2348, 2380
   _types.py10399690%82, 91–92, 146, 151, 170, 172, 176, 180, 182, 184, 186, 204, 208, 234, 256, 261, 266, 270, 296, 300, 646–647, 1018, 1080, 1097, 1115, 1120, 1138, 1148, 1165–1166, 1168, 1186–1187, 1189, 1196–1197, 1199, 1234, 1245–1246, 1248, 1286, 1543, 1596, 1603, 1625, 1631, 1679, 1722–1727, 1749, 1754, 1883, 1895, 2134, 2143, 2163, 2255, 2476, 2681, 2751, 2763, 2770, 2781, 2985–2987, 2990–2992, 2996, 3001, 3005, 3117–3119, 3147, 3201, 3205–3207, 3209, 3220–3221, 3224–3228, 3234
   observability.py6078486%334, 336–338, 341–343, 348–349, 355–356, 362–363, 370, 372–374, 377–379, 384–385, 391–392, 398–399, 406, 662, 665, 673–674, 677–680, 682, 685–687, 690–691, 719, 721, 732–734, 736–739, 743, 751, 852, 854, 1003, 1005, 1009–1014, 1016, 1019–1023, 1025, 1137–1138, 1140, 1191–1192, 1327, 1375–1376, 1492–1494, 1553, 1723, 1877, 1879
packages/core/agent_framework/_workflows
   _model_utils.py311261%19, 23, 35, 37–40, 47–51
packages/core/agent_framework/azure
   _assistants_client.py410100% 
   _chat_client.py80495%303, 305, 318–319
   _responses_client.py38684%148, 171, 200–203
packages/core/agent_framework/openai
   _assistant_provider.py1111190%158–159, 171, 296, 362, 477–482
   _assistants_client.py2763587%360, 362, 364, 367, 371–372, 375, 378, 383–384, 386, 389–391, 396, 407, 432, 434, 436, 438, 440, 445, 448, 451, 455, 466, 551, 636, 673, 710–713, 765, 782
   _chat_client.py2682192%181–182, 186, 300, 307, 388–395, 397–400, 410, 495, 532, 548
   _responses_client.py5636288%279–280, 285, 316, 324, 347, 409, 441, 466, 472, 490–491, 513, 518, 574, 588, 605, 618, 673, 752, 757, 761–763, 767–768, 791, 860, 882–883, 898–899, 917–918, 1049–1050, 1066, 1068, 1143–1151, 1199, 1254, 1269, 1305–1306, 1308–1310, 1324–1326, 1336–1337, 1343, 1358
packages/purview/agent_framework_purview
   _models.py4579678%222–226, 308, 310, 332, 334, 338, 365, 369, 416–421, 424–431, 442–445, 456–459, 489–490, 493, 495, 497–499, 533, 535, 537, 539, 541, 543, 545, 550–552, 554, 557, 563, 566, 605, 607, 609, 611, 613, 621, 623, 625, 627, 661, 665, 700, 702, 704, 708, 714, 716, 738–739, 764, 766, 768, 772, 791–793, 798–799, 832, 834, 846, 909, 912–916, 918, 946, 977, 979
TOTAL16592205987% 

Python Unit Test Overview

Tests Skipped Failures Errors Time
3925 225 💤 0 ❌ 0 🔥 1m 10s ⏱️

@giles17 giles17 enabled auto-merge February 9, 2026 23:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Python: all: Standardize TypeVar naming convention to use suffix T

2 participants