-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
.Net: Adds Process Framework with Aspire demo (#10614)
### Motivation and Context This demo aims to showcase how the [Semantic Kernel Process Framework](https://learn.microsoft.com/en-us/semantic-kernel/overview/) can be used with [.NET Aspire](https://learn.microsoft.com/en-us/dotnet/aspire/get-started/aspire-overview). The Process Framework allows developers to create business processes based on events. Each step of the process can be an agent or native code. ### Description In this demo, I have defined the agents as external services, and each step will call these agents using HTTP requests. This setup allows .NET Aspire to add value by tracing the process using OpenTelemetry. Additionally, since each agent is a service, they can be restarted as needed using the .NET Aspire developer dashboard.  ### Why .NET Aspire? Thanks to .NET Aspire, developers can leverage the developer dashboard to debug in real time the Process and all the agents running. Since the agents are single APIs, each can scale independently from each other.    ### Contribution Checklist <!-- Before submitting this PR, please make sure: --> - [x] The code builds clean without any errors or warnings - [x] The PR follows the [SK Contribution Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md) and the [pre-submission formatting script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts) raises no violations - [x] All unit tests pass, and I have added new tests where possible - [x] I didn't break anyone 😄 --------- Co-authored-by: Chris Rickman <crickman@microsoft.com> Co-authored-by: Chris <66376200+crickman@users.noreply.github.com> Co-authored-by: Devis Lucato <dluc@users.noreply.github.com>
- Loading branch information
1 parent
f431685
commit 4c91cfd
Showing
33 changed files
with
897 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
34 changes: 34 additions & 0 deletions
34
...ssFramework.Aspire/ProcessFramework.Aspire.AppHost/ProcessFramework.Aspire.AppHost.csproj
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<Sdk Name="Aspire.AppHost.Sdk" Version="9.0.0" /> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<RollForward>LatestMajor</RollForward> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
<IsAspireHost>true</IsAspireHost> | ||
<UserSecretsId>61efcc24-41eb-4a92-8ebe-64de14ed54dd</UserSecretsId> | ||
<NoWarn>$(NoWarn);CS1591</NoWarn> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Aspire.Hosting.AppHost" /> | ||
<PackageReference Include="Aspire.Hosting.Azure.CognitiveServices" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference | ||
Include="..\..\..\..\..\src\Experimental\Process.LocalRuntime\Process.LocalRuntime.csproj"> | ||
<IsAspireProjectResource>false</IsAspireProjectResource> | ||
</ProjectReference> | ||
<ProjectReference | ||
Include="..\ProcessFramework.Aspire.ProcessOrchestrator\ProcessFramework.Aspire.ProcessOrchestrator.csproj" /> | ||
<ProjectReference | ||
Include="..\ProcessFramework.Aspire.SummaryAgent\ProcessFramework.Aspire.SummaryAgent.csproj" /> | ||
<ProjectReference | ||
Include="..\ProcessFramework.Aspire.TranslatorAgent\ProcessFramework.Aspire.TranslatorAgent.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
17 changes: 17 additions & 0 deletions
17
...essFrameworkWithAspire/ProcessFramework.Aspire/ProcessFramework.Aspire.AppHost/Program.cs
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// Copyright (c) Microsoft. All rights reserved. | ||
|
||
var builder = DistributedApplication.CreateBuilder(args); | ||
|
||
var openai = builder.AddConnectionString("openAiConnectionName"); | ||
|
||
var translateAgent = builder.AddProject<Projects.ProcessFramework_Aspire_TranslatorAgent>("translatoragent") | ||
.WithReference(openai); | ||
|
||
var summaryAgent = builder.AddProject<Projects.ProcessFramework_Aspire_SummaryAgent>("summaryagent") | ||
.WithReference(openai); | ||
|
||
var processOrchestrator = builder.AddProject<Projects.ProcessFramework_Aspire_ProcessOrchestrator>("processorchestrator") | ||
.WithReference(translateAgent) | ||
.WithReference(summaryAgent); | ||
|
||
builder.Build().Run(); |
12 changes: 12 additions & 0 deletions
12
...meworkWithAspire/ProcessFramework.Aspire/ProcessFramework.Aspire.AppHost/appsettings.json
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"Logging": { | ||
"LogLevel": { | ||
"Default": "Information", | ||
"Microsoft.AspNetCore": "Warning", | ||
"Aspire.Hosting.Dcp": "Warning" | ||
} | ||
}, | ||
"ConnectionStrings": { | ||
"openAiConnectionName": "https://{account_name}.openai.azure.com/" | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
...ocessFramework.Aspire/ProcessFramework.Aspire.ProcessOrchestrator/Models/ProcessEvents.cs
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// Copyright (c) Microsoft. All rights reserved. | ||
|
||
namespace ProcessFramework.Aspire.ProcessOrchestrator.Models; | ||
|
||
public static class ProcessEvents | ||
{ | ||
public static readonly string TranslateDocument = nameof(TranslateDocument); | ||
public static readonly string DocumentTranslated = nameof(DocumentTranslated); | ||
public static readonly string SummarizeDocument = nameof(SummarizeDocument); | ||
public static readonly string DocumentSummarized = nameof(DocumentSummarized); | ||
} |
28 changes: 28 additions & 0 deletions
28
...ssFramework.Aspire.ProcessOrchestrator/ProcessFramework.Aspire.ProcessOrchestrator.csproj
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<Project Sdk="Microsoft.NET.Sdk.Web"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<RollForward>LatestMajor</RollForward> | ||
<Nullable>enable</Nullable> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<NoWarn> | ||
$(NoWarn);CS8618,IDE0009,CA1051,CA1050,CA1707,CA1054,CA2007,VSTHRD111,CS1591,RCS1110,RCS1243,CA5394,SKEXP0001,SKEXP0010,SKEXP0020,SKEXP0040,SKEXP0050,SKEXP0060,SKEXP0070,SKEXP0080,SKEXP0101,SKEXP0110,OPENAI001 | ||
</NoWarn> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.AspNetCore.OpenApi" /> | ||
<PackageReference Include="Aspire.Azure.AI.OpenAI" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\..\..\..\..\src\Experimental\Process.Core\Process.Core.csproj" /> | ||
<ProjectReference | ||
Include="..\..\..\..\..\src\Experimental\Process.LocalRuntime\Process.LocalRuntime.csproj" /> | ||
<ProjectReference | ||
Include="..\ProcessFramework.Aspire.ServiceDefaults\ProcessFramework.Aspire.ServiceDefaults.csproj" /> | ||
<ProjectReference | ||
Include="..\ProcessFramework.Aspire.Shared\ProcessFramework.Aspire.Shared.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
5 changes: 5 additions & 0 deletions
5
...cessFramework.Aspire.ProcessOrchestrator/ProcessFramework.Aspire.ProcessOrchestrator.http
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
GET https://localhost:7207/api/processdoc | ||
Accept: application/json | ||
|
||
### | ||
|
Oops, something went wrong.