Skip to content

Python: Implement annotation-based context compaction#4469

Draft
eavanvalkenburg wants to merge 3 commits intomicrosoft:mainfrom
eavanvalkenburg:python_compaction
Draft

Python: Implement annotation-based context compaction#4469
eavanvalkenburg wants to merge 3 commits intomicrosoft:mainfrom
eavanvalkenburg:python_compaction

Conversation

@eavanvalkenburg
Copy link
Member

@eavanvalkenburg eavanvalkenburg commented Mar 4, 2026

Summary

  • implement annotation-based context compaction primitives and built-in strategies in packages/core/agent_framework/_compaction.py
  • wire compaction through BaseChatClient and simplify FunctionInvocationLayer so compaction happens in the chat client layer
  • add and update core compaction/function-loop tests, plus compaction samples under samples/02-agents/compaction

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@markwallace-microsoft markwallace-microsoft added documentation Improvements or additions to documentation python labels Mar 4, 2026
@github-actions github-actions bot changed the title Implement annotation-based context compaction Python: Implement annotation-based context compaction Mar 4, 2026
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@markwallace-microsoft
Copy link
Member

markwallace-microsoft commented Mar 4, 2026

Python Test Coverage

Python Test Coverage Report •
FileStmtsMissCoverMissing
packages/core/agent_framework
   _agents.py3494188%436, 440, 492, 867, 903, 919, 1002–1005, 1068, 1190, 1206, 1208, 1221, 1227, 1263, 1265, 1274–1279, 1284, 1286, 1292–1293, 1300, 1302–1303, 1311–1312, 1315–1317, 1325–1326, 1328, 1333, 1335
   _clients.py1131091%309, 355, 464–467, 554, 556, 561, 565
   _compaction.py4625687%102, 148–160, 167–169, 175–176, 191–194, 201–203, 249, 273, 283, 345, 348, 350, 369, 411–416, 428, 500, 502, 517, 621, 642, 703, 705, 721, 728, 733, 748, 756, 846, 849, 867, 883
TOTAL23040286187% 

Python Unit Test Overview

Tests Skipped Failures Errors Time
4607 25 💤 0 ❌ 0 🔥 1m 21s ⏱️

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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 python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants