Share via


AggregatorTerminationStrategy Class

A strategy that aggregates multiple termination strategies.

Note: This class is marked as 'experimental' and may change in the future.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Constructor

AggregatorTerminationStrategy(*, strategies: list[TerminationStrategy], condition: AggregateTerminationCondition = AggregateTerminationCondition.ALL)

Keyword-Only Parameters

Name Description
strategies
Required
condition
Default value: AggregateTerminationCondition.ALL

Methods

should_terminate_async

Check if the agent should terminate.

should_terminate_async

Check if the agent should terminate.

async should_terminate_async(agent: Agent, history: list[ChatMessageContent]) -> bool

Parameters

Name Description
agent
Required

The agent to check.

history
Required

The history of messages in the conversation.

Returns

Type Description

True if the agent should terminate, False otherwise

Attributes

condition

condition: AggregateTerminationCondition

is_experimental

is_experimental = True

stage_status

stage_status = 'experimental'

strategies

strategies: list[TerminationStrategy]