Skip to content

Add Microsoft Agent Framework integration with code-first agents and multi-agent workflows#99

Merged
sfmskywalker merged 24 commits intomainfrom
copilot/refactor-agents-to-microsoft-framework
Dec 14, 2025
Merged

Add Microsoft Agent Framework integration with code-first agents and multi-agent workflows#99
sfmskywalker merged 24 commits intomainfrom
copilot/refactor-agents-to-microsoft-framework

Conversation

Copy link
Contributor

Copilot AI commented Dec 11, 2025

Adds support for code-first agents and removes Service and ApiKey entities for easier usage and greater control.

Copilot AI and others added 5 commits December 11, 2025 20:20
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
Copilot AI requested a review from sfmskywalker December 11, 2025 20:35
@sfmskywalker sfmskywalker marked this pull request as ready for review December 12, 2025 08:28
Copilot AI review requested due to automatic review settings December 12, 2025 08:28
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

…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.
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 sfmskywalker merged commit f0d1534 into main Dec 14, 2025
5 of 8 checks passed
@sfmskywalker sfmskywalker deleted the copilot/refactor-agents-to-microsoft-framework branch December 14, 2025 14:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants