Skip to content

Feature Request: Add Explicit Termination Mechanism for Multi-Agent Workflows (Similar to AutoGen “TERMINATE”) #29

@davidmonterocrespo24

Description

@davidmonterocrespo24

Is your feature request related to a problem? Please describe.

In multi-agent workflows using ADK, agents can sometimes fall into infinite or long-running loops during collaborative tasks. This happens especially when orchestration depends only on message passing, with no built-in signal to indicate that the task is completed.
Other multi-agent frameworks — for example, Microsoft’s AutoGen — include explicit termination mechanisms (e.g., TextMentionTermination, StopMessageTermination, or custom termination callbacks) that help teams of agents know when to gracefully stop.
In ADK today, there is no simple built-in mechanism for agents to signal “task completed,” which can lead to runaway conversations, wasted tokens, and stalled agent workflows.

Describe the solution you'd like

I would like ADK to support a standardized “terminate” mechanism that allows:

Agents to explicitly signal termination, for example by producing a special message type (like StopMessage in AutoGen) that ends the conversation.

Teams to define termination conditions, such as detecting a specific keyword (“TERMINATE”), max message counts, function call results, token usage, or any other customizable logic.

External termination control, so that applications integrating ADK can stop a run programmatically (e.g., a UI “Stop” button).

Composable termination conditions, allowing multiple rules combined with AND/OR logic (similar to AutoGen’s MaxMessageTermination | TextMentionTermination).

This would give ADK parity with AutoGen’s termination system and prevent infinite loops in multi-agent workflows.

Describe alternatives you've considered

Implementing custom stop messages manually in agent prompts.
This is unreliable because agents may not follow instructions consistently.

Using max iterations as a safeguard.
This avoids infinite loops but doesn’t allow agents to end a task early when they know they are done.

External timeout logic.
Helps prevent long runs but still doesn’t let agents indicate completion intentionally.

None of these alternatives provide the simple, robust, and explicit termination controls that AutoGen offers.

Additional context

AutoGen’s termination system includes several useful termination primitives:

TextMentionTermination (stop when a keyword appears)

MaxMessageTermination

TokenUsageTermination

TimeoutTermination

FunctionCallTermination

ExternalTermination

StopMessageTermination

Replicating these concepts in ADK would give developers much more control over agent lifecycles, prevent infinite loops, and improve reliability for multi-agent compositions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions