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

.Net: Python: Multi-Agent Orchestration Termination Strategy Support

Open vamsithumma2812 opened this issue 5 months ago • 4 comments

Summary

The current multi-agent orchestrations (specifically MagenticOne) lack termination strategy functionality that exists in AutoGen and Semantic Kernel AgentGroupChat, leading to token consumption issues and poor user experience.

Problem Description

When using MagenticOne orchestration, I encounter the following issues:

  1. Infinite loops: The orchestrator runs in a never-ending loop until it solves the user's task, consuming excessive tokens and requiring manual termination
  2. Inadequate max_round_count behavior: When using the max_round_count parameter and the limit is reached, the final response is not a summarized output of the task but just the response from the final agent the orchestrator called
  3. Missing termination conditions: Unlike AutoGen, there's no built-in way to define custom termination conditions for multi-agent orchestrations

Current Workaround

Currently, I have to manually monitor and terminate processes, which is not practical for production use cases.

Proposed Solution

Implement termination strategy functionality for Multi-Agent Orchestrations similar to what's available in:

  • AutoGen's termination conditions
  • AgentGroupChat's termination features

Environment

  • Python

Additional Context

This feature exists in AgentGroupChat but is missing from multi-agent orchestrations, creating inconsistency in the framework's capabilities.

Questions

  1. Is this feature planned for implementation?
  2. Are there any existing examples or workarounds for implementing custom termination strategies?

vamsithumma2812 avatar Jul 20 '25 02:07 vamsithumma2812

@TaoChenOSU - This applies to both .NET and Python

crickman avatar Jul 25 '25 03:07 crickman

Related to #12687

TaoChenOSU avatar Aug 03 '25 21:08 TaoChenOSU

Hi @vamsithumma2812,

Thank you for your questions and feature request!

Yes, the feature request for termination strategies is planned and it's in our backlog. We will get to it ASAP.

To answer your other questions:

  1. Depending on the language you use, you can set the following properties on the manager to prevent infonite loops:
    • C#: MaximumInvocationCount or MaximumResetCount (to be used with MaximumStallCount)
    • Python: max_reset_count or max_round_count (to be used with max_stall_count)
  2. As explained in #12687, we cannot synthesize the answer as we don't know if the context produced so far is good enough to be synthesized. Instead, we log an error message and return the most recent agent response if available or a clear description that some limit has been reached.

TaoChenOSU avatar Aug 03 '25 21:08 TaoChenOSU

This issue is stale because it has been open for 90 days with no activity.

github-actions[bot] avatar Nov 02 '25 02:11 github-actions[bot]