Skip to content

Python: Support Process State Management #11637

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 27 commits into from
Apr 28, 2025

Conversation

moonbox3
Copy link
Contributor

Motivation and Context

SK Python processes have been missing support to be able to serialize and deserialize JSON state for a process and its steps. This PR brings in the functionality to allow the developer to do so. The getting_started_with_processes step03 has been update to reflect this latest functionality. It is possible to dump a JSON state to a file, and reload the state to continue running the process.

State metadata that handles the version for steps is managed via a decorator:

@kernel_process_step_metadata("CutFoodStep.V1")
class CutFoodStep(KernelProcessStep):
    class Functions(Enum):
        ChopFood = "ChopFood"
        SliceFood = "SliceFood"

If no decorator/state is supplied the step will be built with a default state version of "v1" which aligns with .Net.

Description

Support state and versioning management for Python processes.

Contribution Checklist

@moonbox3 moonbox3 self-assigned this Apr 18, 2025
@moonbox3 moonbox3 requested a review from a team as a code owner April 18, 2025 05:14
@markwallace-microsoft markwallace-microsoft added the python Pull requests for the Python Semantic Kernel label Apr 18, 2025
@markwallace-microsoft
Copy link
Member

markwallace-microsoft commented Apr 18, 2025

Python Unit Test Overview

Tests Skipped Failures Errors Time
3470 5 💤 0 ❌ 0 🔥 1m 37s ⏱️

Copy link
Member

@eavanvalkenburg eavanvalkenburg left a comment

Choose a reason for hiding this comment

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

Some initial thoughts, I'll do another round when I'm behind a bigger screen

@moonbox3 moonbox3 requested a review from alliscode April 22, 2025 05:14
Copy link
Contributor

@esttenorio esttenorio left a comment

Choose a reason for hiding this comment

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

:shipit:

@moonbox3 moonbox3 enabled auto-merge April 28, 2025 03:26
@moonbox3 moonbox3 added this pull request to the merge queue Apr 28, 2025
@moonbox3 moonbox3 removed this pull request from the merge queue due to a manual request Apr 28, 2025
@moonbox3 moonbox3 enabled auto-merge April 28, 2025 22:13
@moonbox3 moonbox3 added this pull request to the merge queue Apr 28, 2025
Merged via the queue into microsoft:main with commit 30d2b08 Apr 28, 2025
28 checks passed
@moonbox3 moonbox3 deleted the py-process-state-mgmt branch April 28, 2025 23:00
@github-project-automation github-project-automation bot moved this to Sprint: Done in Semantic Kernel Apr 28, 2025
@jsboige
Copy link
Contributor

jsboige commented Apr 29, 2025

@moonbox3 Have you had a look at https://github.com/UiPath/CoreWF, which seems like a thorough implementation of the same idea?

@moonbox3
Copy link
Contributor Author

@moonbox3 Have you had a look at https://github.com/UiPath/CoreWF, which seems like a thorough implementation of the same idea?

@jsboige thanks for sharing -- CoreWF is interesting, but it serves a very different purpose. It's a Windows Workflow Foundation reimplementation for .NET, more aligned with UiPath's RPA and orchestration model. Semantic Kernel's process framework, on the other hand, is tailored specifically for AI service/agentic LLM orchestration within the SK runtime and SDK, with a strong emphasis on interoperability, function calling that leverage native code plugins, and memory integration. While both frameworks touch on workflow and coordination, they operate in entirely different ecosystems and solve fundamentally different problems.

glorious-beard pushed a commit to glorious-beard/semantic-kernel that referenced this pull request May 6, 2025
### Motivation and Context

SK Python processes have been missing support to be able to serialize
and deserialize JSON state for a process and its steps. This PR brings
in the functionality to allow the developer to do so. The
`getting_started_with_processes` step03 has been update to reflect this
latest functionality. It is possible to dump a JSON state to a file, and
reload the state to continue running the process.

State metadata that handles the version for steps is managed via a
decorator:

```python
@kernel_process_step_metadata("CutFoodStep.V1")
class CutFoodStep(KernelProcessStep):
    class Functions(Enum):
        ChopFood = "ChopFood"
        SliceFood = "SliceFood"
```

If no decorator/state is supplied the step will be built with a default
state version of "v1" which aligns with .Net.

<!-- Thank you for your contribution to the semantic-kernel repo!
Please help reviewers and future users, providing the following
information:
  1. Why is this change required?
  2. What problem does it solve?
  3. What scenario does it contribute to?
  4. If it fixes an open issue, please link to the issue here.
-->

### Description

Support state and versioning management for Python processes.
- Update samples to reflect changes.
- Closes microsoft#9584

<!-- Describe your changes, the overall approach, the underlying design.
These notes will help understanding how your code works. Thanks! -->

### 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
- [ ] I didn't break anyone 😄
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
processes python Pull requests for the Python Semantic Kernel
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Python: Process state persistence
6 participants