microsoft / microsoft/agent-framework
.NET: Persisting Thread State when using Workflow as Agent
@peibekwe is already working on this.
Since Jun 26, 2026.
- 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.