-
Notifications
You must be signed in to change notification settings - Fork 607
.NET [WIP]: introduce Hosting extensions for Workflows #1359
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Introduces hosting extensions for workflow registration in dependency injection containers, providing similar functionality to existing AIAgent registration APIs. The extensions enable configuration of custom, concurrent, and sequential workflows with an additional capability to expose workflows as AIAgents.
- Adds workflow registration methods (AddWorkflow, AddConcurrentWorkflow, AddSequentialWorkflow) similar to existing AIAgent registration
- Creates workflow-to-agent conversion capability through AddAsAIAgent extension method
- Implements workflow discovery infrastructure with WorkflowCatalog and LocalWorkflowRegistry
Reviewed Changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| HostApplicationBuilderWorkflowExtensions.cs | Core extension methods for registering workflows in DI container |
| IHostWorkflowBuilder.cs / IHostAgentBuilder.cs | New builder interfaces for extensible workflow/agent configuration |
| AgentWorkflowBuilder.cs | Enhanced with PrepareSequential/PrepareConcurrent methods for workflow composition |
| WorkflowCatalog.cs / LocalWorkflowCatalog.cs | Workflow discovery infrastructure similar to existing agent catalog |
| HostApplicationBuilderAgentExtensions.cs | Modified to return IHostAgentBuilder instead of IHostApplicationBuilder |
| Program.cs | Sample implementation demonstrating the new workflow registration APIs |
| Test files | Comprehensive unit tests for the new workflow extension methods |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
dotnet/src/Microsoft.Agents.AI.Workflows/AgentWorkflowBuilder.cs
Outdated
Show resolved
Hide resolved
dotnet/src/Microsoft.Agents.AI.Workflows/AgentWorkflowBuilder.cs
Outdated
Show resolved
Hide resolved
dotnet/src/Microsoft.Agents.AI.Hosting/HostApplicationBuilderWorkflowExtensions.cs
Outdated
Show resolved
Hide resolved
…orkflowExtensions.cs Co-authored-by: Copilot <[email protected]>
…crosoft/agent-framework into dmkorolev/workflow-extensions
Hostingpackage today has a set of extension APIs which allow registration of customAIAgents in the dependency injection container. This PR adds similar extenions methods to configure workflows.AIAgent
Today one could create
AIAgentviaAddAIAgent()with minimal parameters:or with the custom delegate on how
AIAgentis configured:Workflows
In order to enable any custom scenario, I've also added a delegate overload to configure workflow:
and a couple overloads to configure concurrent or sequential workflows:
Workflow to Agent
At the moment we dont have a nice API to launch workflow - one would need
InProcessExecution.StreamAsync(workflow)for example. In order to simplify exposure of workflow viaAIAgentI've also added the extension method available only on the return type ofbuilder.AddWorkflow(...)such as.AddAsAIAgent()which converts the workflow intoAIAgentand registers it in DI (with the same or custom name).Extension API
In order to be able to build extension methods on top of
AIAgentorWorkflowregistrations, I've added such types:Those allow distinction between behavior and using extension specific to agents or workflows