Source code for autogen_agentchat.state._states

from typing import Any, List, Mapping, Optional

from autogen_core.models import (
    LLMMessage,
)
from pydantic import BaseModel, Field

from ..messages import (
    AgentMessage,
    ChatMessage,
)


[docs] class BaseState(BaseModel): """Base class for all saveable state""" type: str = Field(default="BaseState") version: str = Field(default="1.0.0")
[docs] class AssistantAgentState(BaseState): """State for an assistant agent.""" llm_messages: List[LLMMessage] = Field(default_factory=list) type: str = Field(default="AssistantAgentState")
[docs] class TeamState(BaseState): """State for a team of agents.""" agent_states: Mapping[str, Any] = Field(default_factory=dict) team_id: str = Field(default="") type: str = Field(default="TeamState")
[docs] class BaseGroupChatManagerState(BaseState): """Base state for all group chat managers.""" message_thread: List[AgentMessage] = Field(default_factory=list) current_turn: int = Field(default=0) type: str = Field(default="BaseGroupChatManagerState")
[docs] class ChatAgentContainerState(BaseState): """State for a container of chat agents.""" agent_state: Mapping[str, Any] = Field(default_factory=dict) message_buffer: List[ChatMessage] = Field(default_factory=list) type: str = Field(default="ChatAgentContainerState")
[docs] class RoundRobinManagerState(BaseGroupChatManagerState): """State for :class:`~autogen_agentchat.teams.RoundRobinGroupChat` manager.""" next_speaker_index: int = Field(default=0) type: str = Field(default="RoundRobinManagerState")
[docs] class SelectorManagerState(BaseGroupChatManagerState): """State for :class:`~autogen_agentchat.teams.SelectorGroupChat` manager.""" previous_speaker: Optional[str] = Field(default=None) type: str = Field(default="SelectorManagerState")
[docs] class SwarmManagerState(BaseGroupChatManagerState): """State for :class:`~autogen_agentchat.teams.Swarm` manager.""" current_speaker: str = Field(default="") type: str = Field(default="SwarmManagerState")
[docs] class MagenticOneOrchestratorState(BaseGroupChatManagerState): """State for :class:`~autogen_agentchat.teams.MagneticOneGroupChat` orchestrator.""" task: str = Field(default="") facts: str = Field(default="") plan: str = Field(default="") n_rounds: int = Field(default=0) n_stalls: int = Field(default=0) type: str = Field(default="MagenticOneOrchestratorState")
[docs] class SocietyOfMindAgentState(BaseState): """State for a Society of Mind agent.""" inner_team_state: Mapping[str, Any] = Field(default_factory=dict) type: str = Field(default="SocietyOfMindAgentState")