semantic-kernel icon indicating copy to clipboard operation
semantic-kernel copied to clipboard

Python: .Net: How to support Human-in-the-Loop in Agent and Process Frameworks

Open fabioparra opened this issue 1 year ago • 4 comments

The Agent Framework + AgentChat can handle multi-turn conversations between agents, but how can I handle multi-turn conversations with the user?

I know Autogen has a UserProxyAgent, but it looks like support for that in Semantic Kernel is delayed or not planned: https://github.com/microsoft/semantic-kernel/issues/6758

Another option is using the Process Framework. Tools like LangGraph, Bedrock Flows, and Dify.AI use similar ideas with prompt chaining. What we really need is the ability to interrupt the KernelProcess to wait for user input.

The flow would be:

  • Interrupt the KernelProcess and wait for user input (human in the loop).
  • Serialize the KernelProcess in its current state. (This is important for web apps with distributed architecture and load balancing.)
  • Get the user input and deserialize the KernelProcess.
  • Resume the KernelProcess.

What are the alternatives we should consider?

  • Wait for Autogen + Semantic Kernel 'Converging Agent Runtimes'.
  • Wait for Process Framework to add interrupt/resume features.
  • Build this in a custom chat framework, like the new Agents for .NET.

Sources: https://www.anthropic.com/engineering/building-effective-agents https://langchain-ai.github.io/langgraph/reference/types/#langgraph.types.interrupt https://langchain-ai.github.io/langgraph/how-tos/multi-agent-multi-turn-convo/ https://langchain-ai.github.io/langgraph/reference/types/#langgraph.types.interrupt https://microsoft.github.io/autogen/stable//user-guide/agentchat-user-guide/tutorial/human-in-the-loop.html https://github.com/microsoft/semantic-kernel/issues/6758 https://github.com/microsoft/semantic-kernel/issues/6783 https://github.com/microsoft/semantic-kernel/issues/10542 https://github.com/microsoft/semantic-kernel/issues/6784 https://microsoft.github.io/autogen/0.2/docs/tutorial/conversation-patterns/ https://microsoft.github.io/autogen/0.2/docs/tutorial/human-in-the-loop/ https://microsoft.github.io/autogen-for-net/articles/Create-a-user-proxy-agent.html

fabioparra avatar Mar 06 '25 13:03 fabioparra

Thank you. Since last two weeks, I was trying to implement this using process framework. Based on the sample code, I thought it supported. All It has console application sample with scripted user input. It worked for console application as Console.ReadLine() will ask user Input. But It didn't work with actual UI chat application. There is no way to pause the process and wait for User input.

DibyaRanjan1 avatar Mar 18 '25 09:03 DibyaRanjan1

@eavanvalkenburg is the Python support for Human-In-Loop still a work-in-progress? Documentation seems to indicate so.

skm-nbrly avatar Sep 17 '25 10:09 skm-nbrly

Hi, thanks for your question!

We have been actively working on this. Please expect some announcements very soon.

Sorry for the wait.

TaoChenOSU avatar Sep 17 '25 18:09 TaoChenOSU

The interrupt/resume pattern for HITL in KernelProcess is a hard problem when done inside the framework — you need durable state, async notification, and a way to resume execution after an arbitrary delay.

An alternative that avoids modifying KernelProcess internals: wrap the tool execution layer with an external governance proxy. The proxy evaluates each tool call against policies, and if a human review is needed, it returns an error immediately. The process handles the error, the human reviews asynchronously (via Slack, Teams, dashboard), and the process retries the tool call.

This is the pattern used by SidClaw — it works across LangChain, CrewAI, OpenAI Agents, Google ADK, and MCP servers with the same governance protocol. The "error-then-retry" approach avoids the complexity of long-polling or blocking execution.

For Semantic Kernel specifically, wrapping the kernel function invocation rather than the process flow is simpler — the governance decision happens at the tool call boundary, not the orchestration layer.

Disclosure: I work on SidClaw.

VladUZH avatar Apr 02 '26 11:04 VladUZH