autogen.agentchat.group.patterns.pattern.Pattern
Pattern
Base abstract class for all orchestration patterns.
Patterns provide a reusable way to define how agents interact within a group chat.
Each pattern encapsulates the logic for setting up agents, configuring handoffs,
and determining the flow of conversation.
This is an abstract base class and should not be instantiated directly.
Use one of the concrete pattern implementations like AutoPattern,
RoundRobinPattern, RandomPattern, or ManualPattern.
Initialize the pattern with the required components.
Name | Description |
---|---|
initial_agent | Type: ConversableAgent |
agents | Type: list[‘ConversableAgent’] |
user_agent | Type: ForwardRef(‘ConversableAgent’) | None Default: None |
group_manager_args | Type: dict[str, typing.Any] | None Default: None |
context_variables | Type: ContextVariables | None Default: None |
group_after_work | Type: TransitionTarget | None Default: None |
exclude_transit_message | Type: bool Default: True |
summary_method | Type: str | Callable[…, Any] | None Default: ‘last_msg’ |
Static Methods
create_default
Create a default pattern with minimal configuration.
This replaces the need for a separate BasePattern class by providing
a factory method that creates a simple DefaultPattern instance.
Name | Description |
---|---|
initial_agent | The first agent to speak in the group chat. Type: ConversableAgent |
agents | List of all agents participating in the chat. Type: list[‘ConversableAgent’] |
user_agent | Optional user proxy agent. Type: ForwardRef(‘ConversableAgent’) | None Default: None |
group_manager_args | Optional arguments for the GroupChatManager. Type: dict[str, typing.Any] | None Default: None |
context_variables | Initial context variables for the chat. Type: ContextVariables | None Default: None |
exclude_transit_message | Whether to exclude transit messages from the conversation. Type: bool Default: True |
summary_method | Method for summarizing the conversation. Type: str | Callable[…, Any] | None Default: ‘last_msg’ |
Instance Methods
prepare_group_chat
Prepare the group chat for orchestration.
This is the main method called by initiate_group_chat to set up the pattern.
Subclasses must implement or extend this method to define pattern-specific behavior.
Name | Description |
---|---|
max_rounds | Maximum number of conversation rounds. Type: int |
messages | Initial message(s) to start the conversation. Type: list[dict[str, typing.Any]] | str |
Type | Description |
---|---|
Tuple[list[‘ConversableAgent’], list[‘ConversableAgent’], ConversableAgent | None, ContextVariables, ConversableAgent, TransitionTarget, GroupToolExecutor, GroupChat, GroupChatManager, list[dict[str, Any]], ConversableAgent, list[str], list[‘Agent’]] | Tuple containing: - List of agents involved in the group chat - List of wrapped agents - User agent, if applicable - Context variables for the group chat - Initial agent for the group chat - Group-level after work transition for the group chat - Tool executor for the group chat - GroupChat instance - GroupChatManager instance - Processed messages - Last agent to speak - List of group agent names - List of temporary user agents |