Skip to content

Commit 1d616cb

Browse files
Copilotsfmskywalker
andcommitted
Add migration guide for Agent Framework features
Co-authored-by: sfmskywalker <938393+sfmskywalker@users.noreply.github.com>
1 parent e03d1bf commit 1d616cb

1 file changed

Lines changed: 144 additions & 0 deletions

File tree

Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
# Migration Guide: Microsoft Agent Framework Integration
2+
3+
This guide helps you understand and adopt the new Microsoft Agent Framework features in Elsa.Agents.
4+
5+
## What's New
6+
7+
### 1. Microsoft Agent Framework
8+
The module now uses Microsoft's Agent Framework (Semantic Kernel Agents) for agent execution, providing:
9+
- Better multi-agent orchestration
10+
- More flexible agent communication patterns
11+
- Enhanced tool calling capabilities
12+
- Improved state management
13+
14+
### 2. Code-First Agent Registration
15+
You can now define agents programmatically instead of only via JSON/configuration:
16+
17+
```csharp
18+
// Register a code-first agent
19+
services.AddElsa(elsa =>
20+
{
21+
elsa.UseAgents(agents =>
22+
{
23+
agents.Services.AddAgentDefinition<MyCustomAgent>();
24+
});
25+
});
26+
27+
// Define your agent
28+
public class MyCustomAgent : IAgentDefinition
29+
{
30+
public string Name => "MyAgent";
31+
public string Description => "My custom agent";
32+
33+
public AgentConfig GetAgentConfig()
34+
{
35+
return new AgentConfig { /* ... */ };
36+
}
37+
}
38+
```
39+
40+
### 3. Multi-Agent Workflows
41+
Create workflows where multiple agents collaborate:
42+
43+
```csharp
44+
services.AddElsa(elsa =>
45+
{
46+
elsa.UseAgents(agents =>
47+
{
48+
agents.Services.AddAgentWorkflowDefinition<ContentPipeline>();
49+
});
50+
});
51+
52+
public class ContentPipeline : IAgentWorkflowDefinition
53+
{
54+
public AgentWorkflowConfig GetWorkflowConfig()
55+
{
56+
return new AgentWorkflowConfig
57+
{
58+
WorkflowType = AgentWorkflowType.Sequential,
59+
Agents = ["Researcher", "Writer", "Editor"],
60+
Termination = new TerminationConfig
61+
{
62+
Type = TerminationType.MaxMessages,
63+
MaxMessages = 20
64+
}
65+
};
66+
}
67+
}
68+
```
69+
70+
## Backward Compatibility
71+
72+
### No Breaking Changes
73+
All existing functionality continues to work:
74+
- JSON-defined agents ✓
75+
- Database-persisted agents ✓
76+
- Configuration-based agents ✓
77+
- Existing activity providers ✓
78+
79+
### Legacy Mode
80+
The `AgentInvoker` supports both legacy and new execution modes:
81+
82+
```csharp
83+
// New Agent Framework mode (default)
84+
await agentInvoker.InvokeAgentAsync(agentName, input, cancellationToken);
85+
86+
// Legacy Semantic Kernel mode (if needed)
87+
await agentInvoker.InvokeAgentAsync(agentName, input, useAgentFramework: false, cancellationToken);
88+
```
89+
90+
## Migration Strategies
91+
92+
### Strategy 1: No Migration Needed
93+
If you're happy with your current setup, do nothing. Everything continues to work as before.
94+
95+
### Strategy 2: Gradual Adoption
96+
1. Keep existing JSON/DB agents
97+
2. Add new agents using code-first approach
98+
3. Both coexist seamlessly
99+
100+
### Strategy 3: Full Migration
101+
1. Keep JSON agents for configuration
102+
2. Convert complex agents to code-first for better maintainability
103+
3. Create multi-agent workflows for advanced scenarios
104+
105+
## New Capabilities
106+
107+
### Workflow Types
108+
- **Sequential**: Agents execute in order
109+
- **Graph**: Custom orchestration with agent selection
110+
111+
### Termination Strategies
112+
- **MaxMessages**: Stop after N turns
113+
- **Keyword**: Stop when pattern detected
114+
- **AgentDecision**: Let agent decide when done
115+
116+
### Selection Strategies
117+
- **Sequential**: Fixed order
118+
- **RoundRobin**: Cycle through agents
119+
- **LLMBased**: AI decides next agent
120+
- **AgentBased**: Dedicated selector agent
121+
122+
## Examples
123+
124+
See the following files for complete examples:
125+
- `README.md` - Comprehensive documentation
126+
- `Examples/CodeFirstAgentExample.cs` - Code samples
127+
- `Assets/*.json` - JSON configuration examples
128+
129+
## Getting Help
130+
131+
If you encounter issues:
132+
1. Check the README.md for detailed documentation
133+
2. Review the examples in `Examples/` directory
134+
3. Ensure all agents are properly registered
135+
4. Verify configuration is valid
136+
137+
## Testing
138+
139+
The module includes comprehensive tests:
140+
```bash
141+
dotnet test test/modules/agents/Elsa.Agents.Tests/
142+
```
143+
144+
All tests passing: 6/6 ✓

0 commit comments

Comments
 (0)