Add Microsoft Agent Framework integration with code-first agents and multi-agent workflows#99
Merged
sfmskywalker merged 24 commits intomainfrom Dec 14, 2025
Conversation
Co-authored-by: sfmskywalker <938393+sfmskywalker@users.noreply.github.com>
…ures Co-authored-by: sfmskywalker <938393+sfmskywalker@users.noreply.github.com>
…nfigProvider Co-authored-by: sfmskywalker <938393+sfmskywalker@users.noreply.github.com>
…ed field Co-authored-by: sfmskywalker <938393+sfmskywalker@users.noreply.github.com>
Co-authored-by: sfmskywalker <938393+sfmskywalker@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Refactor agents to use Microsoft Agent Framework APIs
Add Microsoft Agent Framework integration with code-first agents and multi-agent workflows
Dec 11, 2025
Contributor
There was a problem hiding this comment.
Pull request overview
This PR integrates Microsoft's Agent Framework (preview) into Elsa.Agents, adding code-first agent registration and multi-agent workflow orchestration capabilities while maintaining full backward compatibility with existing JSON/DB-defined agents.
Key changes:
- Integration layer for Agent Framework (AgentFrameworkFactory, AgentWorkflowExecutor)
- Code-first APIs for defining agents and multi-agent workflows programmatically
- Extended activity provider to expose both individual agents and agent workflows as Elsa activities
Reviewed changes
Copilot reviewed 29 out of 29 changed files in this pull request and generated 13 comments.
Show a summary per file
| File | Description |
|---|---|
| Directory.Packages.props | Adds Microsoft.SemanticKernel.Agents packages (v1.68.0) |
| Elsa.Agents.Core.csproj | References new Agent Framework packages |
| IAgentDefinition.cs | Interface for code-first agent definitions |
| IAgentWorkflowDefinition.cs | Interface for code-first multi-agent workflows |
| IAgentDefinitionProvider.cs | Provider interface for registered agent definitions |
| IAgentWorkflowDefinitionProvider.cs | Provider interface for registered workflow definitions |
| AgentDefinitionProvider.cs | Implementation collecting all registered agent definitions |
| AgentWorkflowDefinitionProvider.cs | Implementation collecting all registered workflow definitions |
| AgentFrameworkFactory.cs | Converts Elsa configs to Agent Framework ChatCompletionAgent instances |
| AgentWorkflowExecutor.cs | Orchestrates multi-agent workflows with termination/selection strategies |
| AgentInvoker.cs | Extended to support both legacy SK and Agent Framework modes |
| ConfigurationKernelConfigProvider.cs | Merges JSON/config agents with code-first definitions |
| AgentWorkflowResult.cs | Result model for workflow execution |
| AgentsOptions.cs | Initializes collections to non-null defaults |
| ServiceCollectionExtensions.cs | Extension methods for registering code-first agents/workflows |
| AgentsFeature.cs | Registers new services in DI container |
| KernelConfig.cs | Adds AgentWorkflows dictionary |
| AgentWorkflowConfig.cs | Configuration model for multi-agent workflows |
| TerminationConfig.cs | Workflow termination strategy configuration |
| SelectionStrategyConfig.cs | Agent selection strategy configuration |
| AgentActivityProvider.cs | Extended to create activities for both agents and workflows |
| AgentWorkflowActivity.cs | Activity implementation for executing agent workflows |
| CodeFirstAgentExample.cs | Example implementations of IAgentDefinition and IAgentWorkflowDefinition |
| README.md | Comprehensive documentation with examples and API reference |
| MIGRATION_GUIDE.md | Migration guide for adopting new features |
| Elsa.Agents.Tests.csproj | New test project file (missing critical configuration) |
| ConfigurationKernelConfigProviderTests.cs | Tests for config/code-first agent merging |
| AgentDefinitionProviderTests.cs | Tests for agent definition provider |
| AgentWorkflowDefinitionProviderTests.cs | Tests for workflow definition provider |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
src/modules/agents/Elsa.Agents.Core/Services/ConfigurationKernelConfigProvider.cs
Outdated
Show resolved
Hide resolved
src/modules/agents/Elsa.Agents.Activities/ActivityProviders/ConfiguredAgentActivityProvider.cs
Show resolved
Hide resolved
src/modules/agents/Elsa.Agents.Activities/ActivityProviders/AgentActivityProvider.cs
Outdated
Show resolved
Hide resolved
src/modules/agents/Elsa.Agents.Core/Services/AgentWorkflowExecutor.cs
Outdated
Show resolved
Hide resolved
src/modules/agents/Elsa.Agents.Core/Services/AgentWorkflowExecutor.cs
Outdated
Show resolved
Hide resolved
src/modules/agents/Elsa.Agents.Core/Services/AgentFrameworkFactory.cs
Outdated
Show resolved
Hide resolved
src/modules/agents/Elsa.Agents.Activities/ActivityProviders/ConfiguredAgentActivityProvider.cs
Show resolved
Hide resolved
src/modules/agents/Elsa.Agents.Activities/ActivityProviders/AgentActivityProvider.cs
Outdated
Show resolved
Hide resolved
…ty dialog component provider.
…pport. This commit removes the deprecated KernelFactory and its interfaces, shifting focus to the new Agent Framework. It introduces enhanced activities, such as the CopyWriterAndEditorActivity, updates service configuration for better agent execution, and incorporates semantic kernel dependencies for future extensibility.
This update removes Semantic Kernel-based multi-agent workflow definitions and implementations. It introduces a new extensibility model with code-first agent registration using `IElsaAgent` and related abstractions. A sample `CopyWriterAndEditorAgent` is added to demonstrate the new code-first agent infrastructure.
Updated agent activity handling to support property mapping, improved JSON response detection, and added a code-first activity provider. Enhanced dependency injection with new agent options and packages, and modified OpenAI client API key retrieval. Refined descriptors and workflows for better configurability and clarity.
Replaced legacy agent workflow classes with streamlined implementations, consolidating agent resolution and execution. Introduced `CodeFirstAgentResolver` and `CodeFirstAgentActivity` for better modularity and flexibility. Removed obsolete types and redundant code to enhance maintainability.
Replaced `CopyWriterAndEditorAgent` with `NativeStoryWriterAgent` and `DecoratedStoryWriterAgent` for streamlined storytelling logic. Refactored code to introduce a unified `IAgent` abstraction, updated resolver logic, and decoupled agent persistence and activities. Cleaned up redundant code, enhanced modularity, and updated usage patterns for OpenAI API integration.
Updated terminology across the agents framework, replacing "plugins" with "skills" to enhance semantic clarity. Includes renaming types, methods, endpoints, and properties, and refactoring related logic and configuration.
Deleted obsolete API key and service management classes, endpoints, and associated UI components. These functionalities are no longer required and their removal simplifies the codebase by eliminating unused or redundant features.
This commit adds migrations to drop the ApiKeyDefinition and ServiceDefinition tables for SQLite, MySQL, PostgreSQL, and SQL Server. It also updates `ModelSnapshot` files and adds EF Core migration scripts for the respective databases to reflect this schema change. Additionally, the solution file was updated to include new EF Core projects.
Introduced a new module `Elsa.Agents.AzureOpenAI` for integrating Azure OpenAI with Elsa Agents. The module supports Azure OpenAI chat completions and is added to the main solution and dependencies. Adjusted related files to accommodate this new feature.
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 153 out of 157 changed files in this pull request and generated no new comments.
Files not reviewed (4)
- src/modules/agents/Elsa.Agents.Persistence.EFCore.MySql/Migrations/20251213194317_V3_6.Designer.cs: Language not supported
- src/modules/agents/Elsa.Agents.Persistence.EFCore.PostgreSql/Migrations/20251213195607_V3_6.Designer.cs: Language not supported
- src/modules/agents/Elsa.Agents.Persistence.EFCore.SqlServer/Migrations/20251213200214_V3_6.Designer.cs: Language not supported
- src/modules/agents/Elsa.Agents.Persistence.EFCore.Sqlite/Migrations/20251213193144_V3_6.Designer.cs: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…istency. Renamed `AgentActivityProvider` to `ConfigurationAgentActivityProvider` and updated references across activities, features, and handlers to reflect the new naming.
Replaced `TaskActivityAttribute` with `RunAsynchronously` property in `ActivityDescriptor`, simplifying activity configurations. Updated references across code to adopt this new approach, ensuring consistent behavior for asynchronous task activities. Minor changes to naming conventions and style settings were also included.
…agent creation and invocation logic. Replaced concrete `AgentFactory` and `AgentInvoker` usage with their interface equivalents throughout the codebase. Updated DI registrations, refactored dependent classes, and improved modularity for better maintainability and flexibility.
…on logic. Replaced multiple agent configuration options with a single `AgentOptions` class to simplify and standardize configuration management. Introduced `InvokeAgentRequest` model and updated `IAgentInvoker` to improve invocation logic. Removed obsolete types, enhanced modularity, and aligned implementation with cleaner abstractions.
Deleted outdated test classes for agents and workflows, along with their associated configuration tests (`AgentDefinitionProviderTests`, `AgentWorkflowDefinitionProviderTests`, `ConfigurationKernelConfigProviderTests`). Removed corresponding project and solution references to streamline the codebase.
sfmskywalker
approved these changes
Dec 14, 2025
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.
Adds support for code-first agents and removes Service and ApiKey entities for easier usage and greater control.