microsoft / microsoft/agent-framework

.NET: interceptable ChatHistoryProvider and AIContextProvider on an existing ChatClientAgent

Open
#7,728 0 comments 0 reactions 1 assignee View on GitHub

@westey-m is already working on this.

Since Aug 18, 2026.

.NET
Dominant language
Python
Stars
13.6k
Forks
2.3k
Avg merge
2d 45m
Merged PRs (30d)
358

Description

Problem

There is no supported way to intercept or decorate the ChatHistoryProvider and AIContextProvider instances of an existing ChatClientAgent — they are fixed at construction, the agent creates an implicit default InMemoryChatHistoryProvider when none is configured, and per-run overrides can arrive through two separate routes (ChatOptions.AdditionalProperties and base AgentRunOptions.AdditionalProperties, the latter merged with precedence in CreateConfiguredChatOptions).

The agent-hooks integration (#7564) needs verdict-gated durability (denied content never persists; transformed content persists post-transform), and the only way to get it today is a stack of construction-time workarounds in AgentHooksChatClientExtensions.Compose and AgentHooksAgent.WrapRunOptions:

  • clone the caller's ChatClientAgentOptions and wrap both provider kinds in gating decorators;
  • materialize the implicit default provider just to wrap it — which changes the history-conflict flag semantics keyed off "a provider was explicitly configured", requiring the factory to reset Warn/Throw/ClearOnChatHistoryProviderConflict to mimic the implicit default;
  • clone per-run options (copy-on-write) and wrap provider overrides in both AdditionalProperties dictionaries, with ownership checks so a wrapper from a different installation is re-wrapped.

Proposed shape (for discussion)

A first-class provider-decoration seam, e.g. ChatClientAgent (or its options) exposing DecorateChatHistoryProvider(Func<ChatHistoryProvider, ChatHistoryProvider>) / the AICP equivalent, applied uniformly to the configured provider, the implicit default, and any per-run override after merge — so a decorator sees every durable write regardless of how the provider was supplied, and conflict-flag semantics stay the agent's own concern.

Context

Not urgent (per the review thread). cc @westey-m

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.