Repository navigation
.NET: [BREAKING] Allow a custom ChatHistoryProvider for workflows hosted as agents - #8840
Open
Marco Minerva (marcominerva) wants to merge 4 commits into
Conversation
Marco Minerva (marcominerva)
temporarily deployed
to
github-app-auth
September 29, 2026 13:24 — with
GitHub Actions
Inactive
Marco Minerva (marcominerva)
temporarily deployed
to
github-app-auth
September 29, 2026 13:24 — with
GitHub Actions
Inactive
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The options overload introduces an undocumented source incompatibility, and the new failure-notification path lacks tests.
Review effort: Balanced
Findings: 1
Open (2)
What changed in this PR
Adds configurable chat-history persistence to workflows hosted as agents while preserving legacy behavior when no custom provider is supplied.
Changes:
- Introduces
WorkflowAgentOptionsand updatesAsAIAgent. - Integrates custom-provider persistence, failure notification, serialization, and checkpointing.
- Updates tests, public API baselines, and XML references.
| File | Description |
|---|---|
WorkflowHostAgentChatHistoryProviderTests.cs |
Tests provider integration and persistence. |
WorkflowSession.cs |
Accepts explicit invocation messages. |
WorkflowHostingExtensions.cs |
Adds provider parameter and options overload. |
WorkflowHostAgent.cs |
Implements custom provider lifecycle. |
WorkflowAgentOptions.cs |
Defines workflow-agent configuration. |
PublicAPI/netstandard2.0/PublicAPI.Unshipped.txt |
Updates netstandard API baseline. |
PublicAPI/net9.0/PublicAPI.Unshipped.txt |
Updates .NET 9 API baseline. |
PublicAPI/net8.0/PublicAPI.Unshipped.txt |
Updates .NET 8 API baseline. |
PublicAPI/net472/PublicAPI.Unshipped.txt |
Updates .NET Framework API baseline. |
PublicAPI/net10.0/PublicAPI.Unshipped.txt |
Updates .NET 10 API baseline. |
Futures.cs |
Updates AsAIAgent documentation reference. |
DeclarativeWorkflowExecutor.cs |
Updates hosting API reference. |
DeclarativeWorkflowBuilder.cs |
Updates hosting API reference. |
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
Marco Minerva (marcominerva)
temporarily deployed
to
github-app-auth
September 29, 2026 13:34 — with
GitHub Actions
Inactive
Marco Minerva (marcominerva)
temporarily deployed
to
github-app-auth
September 29, 2026 13:43 — with
GitHub Actions
Inactive
…ent-custom-chat-history-provider
Marco Minerva (marcominerva)
deployed
to
github-app-auth
October 28, 2026 15:55 — with
GitHub Actions
Active
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Workflows exposed as agents via
AsAIAgentalways used the internalWorkflowChatHistoryProvider, so callers could not customize how the conversation history is stored or read it back (#6327).WorkflowAgentOptions(Id,Name,Description,ExecutionEnvironment,IncludeExceptionDetails,IncludeWorkflowOutputsInResponse,ChatHistoryProvider) and anAsAIAgent(Workflow, WorkflowAgentOptions)overload.chatHistoryProviderparameter to the existingAsAIAgentoverload, which now delegates to the options-based one.WorkflowHostAgentnow takesWorkflowAgentOptionsand keeps a copy of it.InvokedAsyncwith the request and response messages, or with the exception if the run fails, and can be retrieved viaGetService.PublicAPI.Unshipped.txtfor all target frameworks and the XML doc crefs that pointed to the oldAsAIAgentsignature.BREAKING CHANGE:
WorkflowHostingExtensions.AsAIAgent(Workflow, string?, string?, string?, IWorkflowExecutionEnvironment?, bool, bool)gained a trailing optionalChatHistoryProvider?parameter. Assemblies compiled against the previous version must be recompiled.nullas the first argument, such asworkflow.AsAIAgent(null), no longer compile (CS0121), because they are now ambiguous between the existing overload and the newAsAIAgent(Workflow, WorkflowAgentOptions)overload.Migration: call
workflow.AsAIAgent()or name the argument, e.g.workflow.AsAIAgent(id: null). Behavior is unchanged.Fixes #6327