Where should the kernelProcess object exit? #13213
Replies: 1 comment
-
|
The key distinction is between a process definition/running object and a durable job. A For a short process that must finish before the HTTP response, request scope is fine. For work that must continue after the client disconnects, use this shape instead:
Do not keep one running process object per user in a controller, session, or singleton dictionary and treat that as persistence. For hundreds of users, add bounded concurrency, timeouts/cancellation, durable job state, and a real durable queue/workflow system if jobs must survive deployment or crashes. The Process Framework is currently experimental, which is another reason to keep a persistence boundary around it. The Kernel and AI services should be configured on the server through dependency injection and created/scoped for each execution as their thread-safety requirements dictate. For desktop clients, never ship the model provider API key in the application. The desktop app authenticates to your backend; the backend owns the provider credential and runs the Kernel/process. If you support bring-your-own-key, store each user's key encrypted in a server-side secret store and authorize access to it. A client disconnect then does not terminate the work because the background worker, not the connection, owns the execution. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Regarding the KernelProcess in https://github.com/microsoft/semantic-kernel/tree/167308f53c3ea15aed5ed1140210eed56474c968/dotnet/samples/GettingStartedWithProcesses
Take this code for example -
`
// Build the process to get a handle that can be started
KernelProcess kernelProcess = process.Build();
`
Question is: Where should the kernelProcess object exit?
In an ASPNET Core App?
In a Windows Console/Desktop App?
Seems possible, but API Keys cannot live in the App. No matter where I keep them on the remote server, they have to travel down the internet.
What do you say? Or Am I doing something wrong?
Beta Was this translation helpful? Give feedback.
All reactions