[dotnet-port-api] Add compaction-backed history provider

Open
#1,053 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
25/100
Issue type
Feature
Clarity
Clearly specified
Activity status
Active
Tech stack
go
Domain
backend

Research direction

Start with agent/compaction/historyprovider.go and the existing compaction provider APIs, then run the listed Go tests, including agent/compaction/historyprovider_test.go. Review the additional-context sample and docs/dotnet-go-sdk-feature-comparison.md for the expected integration surface. Done means the provider behavior, persistence and summary replay tests, sample, and parity documentation are all updated and the listed tests pass.

Written by the indexing model from the issue text.

Description

agentic-workflows

[!TIP]
Your pull request is ready to create! 🎉 ✅

Everything is OK—the changes have been pushed to branch copilot/dotnet-port-api-compaction-history-provider-fdbbd9f2ce32e8b7. Please review the changes, including any protected files, before creating the pull request.

Create the pull request

The original pull request description is below.


Summary

Add a compaction-backed history provider in agent/compaction so Go agents can apply reducer-triggered history compaction directly on the history-provider surface instead of only through a separate context provider. The change adds the new provider, covers compacted persistence and summary replay in tests, updates the additional-context sample to use the new API, and refreshes the parity doc to reflect the reduced .NET chat-history gap.

Ported .NET PRs

Breaking Changes

No.

Tests and Examples

  • go test ./agent ./agent/compaction ./examples/02-agents/agents/step17_additional_ai_context
  • Added agent/compaction/historyprovider_test.go
  • Updated examples/02-agents/agents/step17_additional_ai_context/main.go

Notes

  • The live upstream-agent-framework/main fetch was blocked in this environment, so this PR ports the documented chat-history parity gap as a narrow Go realignment instead of tying the change to a freshly inspected upstream PR.
  • Other broader chat-history/storage parity gaps remain out of scope for this PR.

[!NOTE]
GitHub Actions is not permitted to create or approve pull requests in this repository.

The changes have been pushed to branch copilot/dotnet-port-api-compaction-history-provider-fdbbd9f2ce32e8b7 and are ready to review.

To fix the permissions issue, go to SettingsActionsGeneral and enable Allow GitHub Actions to create and approve pull requests. See also: gh-aw FAQ

Show patch preview (49 of 382 lines)
From 1681aba4204460f1c46f2bd66efdd44915c5e54b Mon Sep 17 00:00:00 2001
X-GH-AW-Base-Commit: de821aaf3899669a99a730f66f25ebad31cba62c
From: "github-actions[bot]" <github-actions[bot]@users.noreply.github.com>
Date: Fri, 11 Sep 2026 05:37:42 +0000
Subject: [PATCH] [dotnet-port-api] Add compaction-backed history provider

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---
 agent/compaction/doc.go                       |   6 +-
 agent/compaction/historyprovider.go           | 188 ++++++++++++++++++
 agent/compaction/historyprovider_test.go      | 103 ++++++++++
 docs/dotnet-go-sdk-feature-comparison.md      |   2 +-
 .../step17_additional_ai_context/main.go      |  11 +-
 5 files changed, 305 insertions(+), 5 deletions(-)
 create mode 100644 agent/compaction/historyprovider.go
 create mode 100644 agent/compaction/historyprovider_test.go

diff --git a/agent/compaction/doc.go b/agent/compaction/doc.go
index d4280fe..6b4abab 100644
--- a/agent/compaction/doc.go
+++ b/agent/compaction/doc.go
@@ -1,7 +1,7 @@
 // Copyright (c) Microsoft. All rights reserved.
 
 // Package compaction reduces conversation history to fit a model's context
-// window. It provides a context provider and composable strategies — sliding
-// window, truncation, summarization, tool-result eviction, and context-window
-// sizing — selected by triggers evaluated over a message index.
+// window. It provides history and context providers plus composable strategies
+// — sliding window, truncation, summarization, tool-result eviction, and
+// context-window sizing — selected by triggers evaluated over a message index.
 package compaction
diff --git a/agent/compaction/historyprovider.go b/agent/compaction/historyprovider.go
new file mode 100644
index 0000000..7fcc9db
--- /dev/null
+++ b/agent/compaction/historyprovider.go
@@ -0,0 +1,188 @@
+// Copyright (c) Microsoft. All rights reserved.
+
+package compaction
+
+import (
+	"cmp"
+	"context"
+	"log/slog"
+	"runtime"
+	"slices"
+	"sync
... (truncated)

[!WARNING]

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • github.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "github.com"

See Network Configuration for more information.

Generated by .NET to Go API Porting Agent · copilot · gpt54 · 187.4 AIC · ⌖ 10.6 AIC · ⊞ 19K ·

Dominant language
Go
Stars
619
Forks
56
Avg merge
1d 2h
Merged PRs (30d)
131

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from microsoft/agent-framework-go

All issues in microsoft/agent-framework-go

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.