Skip to content

.Net: Python: Bug: AggregatorTerminationStrategy is not a TerminationStrategy and cannot be used with AgentGroupChat #14591

Open

Description

Describe the bug

AggregatorTerminationStrategy (python/semantic_kernel/agents/strategies/termination/aggregator_termination_strategy.py) cannot be used as a termination strategy for AgentGroupChat. It derives from KernelBaseModel instead of TerminationStrategy, and it exposes should_terminate_async instead of the should_terminate / should_agent_terminate methods that every other termination strategy has and that AgentGroupChat calls.

class AggregatorTerminationStrategy(KernelBaseModel):
    strategies: list[TerminationStrategy]
    condition: AggregateTerminationCondition = Field(default=AggregateTerminationCondition.ALL)

    async def should_terminate_async(self, agent, history) -> bool:
        ...

AgentGroupChat.termination_strategy is typed TerminationStrategy, so pydantic rejects the aggregator, and the class is exported from semantic_kernel.agents.strategies but has no way to be plugged in.

To Reproduce

Run against current main (5b4a326):

from semantic_kernel.agents import AgentGroupChat
from semantic_kernel.agents.strategies import AggregatorTerminationStrategy, DefaultTerminationStrategy

AgentGroupChat(
    termination_strategy=AggregatorTerminationStrategy(
        strategies=[DefaultTerminationStrategy(maximum_iterations=1)]
    )
)

Output:

pydantic_core._pydantic_core.ValidationError: 1 validation error for AgentGroupChat
termination_strategy
  Input should be a valid dictionary or instance of TerminationStrategy [type=model_type, input_value=AggregatorTerminationStra...onCondition.ALL: 'All'>), input_type=AggregatorTerminationStrategy]

The existing unit tests only call should_terminate_async directly, so they never exercise it through a group chat.

Expected behavior

AggregatorTerminationStrategy should be a TerminationStrategy (as in the .NET AggregatorTerminationStrategy), so it can be passed to AgentGroupChat, and it can be scoped with agents and limited with maximum_iterations like the other strategies.

Proposed fix

Make the class derive from TerminationStrategy and move the aggregation logic into should_agent_terminate. Keep should_terminate_async as a thin wrapper that calls it, so existing callers do not break.

I have a fix with tests ready and can open a PR.

Platform

  • Language: Python
  • Source: main branch (5b4a326)
  • OS: Windows, Python 3.13

Activity

  1. changed the title [-]Python: Bug: AggregatorTerminationStrategy is not a TerminationStrategy and cannot be used with AgentGroupChat[/-] [+].Net: Python: Bug: AggregatorTerminationStrategy is not a TerminationStrategy and cannot be used with AgentGroupChat[/+] on Oct 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    .NETIssue or Pull requests regarding .NET codepythonPull requests for the Python Semantic Kerneltriage

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions