-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
.NET: Processes support for sub-processes (#9095)
### Description #### Enables use of sub-processes by adding a process to another process as a step. ##### Event bubbling and visibility: This PR adds the concept of visibility to events within a process. There are two options, `Internal` which keeps the event within the process it's fired in, and `Public` which allows the event to bubble out of the process to parent processes or external systems. Events default to `Internal`. This allows a parent process to receive events that originate from within a sub-process. ##### Targets for process' external events: Processes now expose targets for their external events. When a processes defines a route for an external event by calling `processBuilder.OnExternalEvent(...)...`, the target for this event can now be retrieved by calling `process.GetTargetForExternalEvent(...)`. This allows a parent process to route a step event to the specified entry event of the sub-process. #### Retrieve state of a running or completed process The `*KernelProcessContext` now exposes a `GetStateAsync` method that allows the state of the process to be retrieved on a started process. Closes #9097 ### 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: Ben Thomas <[email protected]>
- Loading branch information
Showing
20 changed files
with
652 additions
and
127 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
21 changes: 21 additions & 0 deletions
21
dotnet/src/Experimental/Process.Abstractions/KernelProcessEventVisibility.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,21 @@ | ||
// Copyright (c) Microsoft. All rights reserved. | ||
|
||
namespace Microsoft.SemanticKernel; | ||
|
||
/// <summary> | ||
/// An enumeration representing the visibility of a <see cref="KernelProcessEvent"/>. This is used to determine | ||
/// if the event is kept within the process it's emitted in, or exposed to external processes and systems. | ||
/// </summary> | ||
public enum KernelProcessEventVisibility | ||
{ | ||
/// <summary> | ||
/// The event is only visible to steps within the same process. | ||
/// </summary> | ||
Internal, | ||
|
||
/// <summary> | ||
/// The event is visible inside the process as well as outside the process. This is useful | ||
/// when the event is intended to be consumed by other processes or external systems. | ||
/// </summary> | ||
Public | ||
} |
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
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
Oops, something went wrong.