mirror of
https://github.com/microsoft/agent-framework.git
synced 2026-06-16 21:04:09 +08:00
f48c4512d3
* updated automation tasks and commands, with alias for the time being * Restore aggregate test exclusions Preserve the legacy all-tests scope for test --all by excluding lab and devui from the default aggregate sweep, while still allowing explicit package selection. Also ignore hidden/generated test directories such as .mypy_cache during aggregate discovery. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * updated versions in pre-commit --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
f48c4512d3
·
2026-03-18 18:39:11 +00:00
History
Context Compaction Samples
This folder demonstrates context compaction patterns introduced by ADR-0019.
Files
basics.py— builds a local message list and applies each built-in strategy one at a time.advanced.py— composes multiple strategies withTokenBudgetComposedStrategy.agent_client_overrides.py— shows client defaults, agent-level overrides, and per-run compaction overrides.custom.py— defines a custom strategy implementing theCompactionStrategyprotocol.tiktoken_tokenizer.py— shows aTokenizerProtocolimplementation backed bytiktoken.compaction_provider.py— usesCompactionProviderwith an agent andInMemoryHistoryProvider.
Run samples with:
uv run samples/02-agents/compaction/basics.py
uv run samples/02-agents/compaction/advanced.py
uv run samples/02-agents/compaction/agent_client_overrides.py
uv run samples/02-agents/compaction/custom.py
uv run samples/02-agents/compaction/tiktoken_tokenizer.py
uv run samples/02-agents/compaction/compaction_provider.py # requires OPENAI_API_KEY