microsoft / microsoft/agent-framework

.NET: Persisting Thread State when using Workflow as Agent

Open
#2,864 5 comments 0 reactions 2 assignees View on GitHub

@peibekwe is already working on this.

Since Jun 26, 2026.

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

Description

Is there a way to use ChatClientAgentOptions in Workflow as Agent to setup ChatMessageStoreFactory (https://learn.microsoft.com/en-us/agent-framework/tutorials/agents/third-party-chat-history-storage?pivots=programming-language-csharp)

For e.g
`ChatClientAgent agent = azureOpenAIClient
.GetChatClient("gpt-4.1-mini")
.CreateAIAgent(
new ChatClientAgentOptions
{
ChatMessageStoreFactory = context => new MyMessageStore(context)
}
);`

Similar is it possible when workflow is converted to AsAgent as shown below

`var workflowAgent = workflow.AsAgent(id: "workflow-agent", name: "Workflow Agent");
var workflowAgentThread = workflowAgent.GetNewThread();`

https://learn.microsoft.com/en-us/agent-framework/user-guide/workflows/as-agents?pivots=programming-language-csharp

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.