SequentialSelectionStrategy Class
Round-robin turn-taking strategy. Agent order is based on the order in which they joined.
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
SequentialSelectionStrategy(*, has_selected: bool = False, initial_agent: Agent | None = None)
Keyword-Only Parameters
Name | Description |
---|---|
has_selected
Required
|
|
initial_agent
Required
|
|
Methods
model_post_init |
This function is meant to behave like a BaseModel method to initialise private attributes. It takes context as an argument since that's what pydantic-core passes when calling it. |
reset |
Reset selection to the initial/first agent. |
select_agent |
Select the next agent in a round-robin fashion. |
model_post_init
This function is meant to behave like a BaseModel method to initialise private attributes.
It takes context as an argument since that's what pydantic-core passes when calling it.
model_post_init(context: Any, /) -> None
Positional-Only Parameters
Name | Description |
---|---|
context
Required
|
|
Parameters
Name | Description |
---|---|
self
Required
|
The BaseModel instance. |
context
Required
|
The context. |
reset
Reset selection to the initial/first agent.
reset() -> None
select_agent
Select the next agent in a round-robin fashion.
async select_agent(agents: list[Agent], history: list[ChatMessageContent]) -> Agent
Parameters
Name | Description |
---|---|
agents
Required
|
The list of agents to select from. |
history
Required
|
The history of messages in the conversation. |
Returns
Type | Description |
---|---|
The agent who takes the next turn. |
Attributes
has_selected
has_selected: bool
initial_agent
initial_agent: Agent | None
is_experimental
is_experimental = True
stage_status
stage_status = 'experimental'