AutoPattern
autogen.agentchat.group.patterns.auto.AutoPattern #
AutoPattern(initial_agent, agents, user_agent=None, group_manager_args=None, context_variables=None, selection_message=None, exclude_transit_message=True, summary_method='last_msg')
Bases: Pattern
AutoPattern implements a flexible pattern where agents are selected based on their expertise.
In this pattern, a group manager automatically selects the next agent to speak based on the context of the conversation and agent descriptions. The after_work is always set to "group_manager" as this is the defining characteristic of this pattern.
Initialize the AutoPattern.
The after_work is always set to group_manager selection, which is the defining characteristic of this pattern. You can customize the selection message used by the group manager when selecting the next agent.
PARAMETER | DESCRIPTION |
---|---|
initial_agent | The first agent to speak in the group chat. TYPE: |
agents | List of all agents participating in the chat. TYPE: |
user_agent | Optional user proxy agent. TYPE: |
group_manager_args | Optional arguments for the GroupChatManager. |
context_variables | Initial context variables for the chat. TYPE: |
selection_message | Custom message to use when the group manager is selecting agents. TYPE: |
exclude_transit_message | Whether to exclude transit messages from the conversation. TYPE: |
summary_method | Method for summarizing the conversation. TYPE: |
Source code in autogen/agentchat/group/patterns/auto.py
group_after_work instance-attribute
#
group_after_work = group_after_work if group_after_work is not None else TerminateTarget()
prepare_group_chat #
Prepare the group chat for organic agent selection.
Ensures that: 1. The group manager has a valid LLM config 2. All agents have appropriate descriptions for the group manager to use
PARAMETER | DESCRIPTION |
---|---|
max_rounds | Maximum number of conversation rounds. TYPE: |
messages | Initial message(s) to start the conversation. |
RETURNS | DESCRIPTION |
---|---|
Tuple[list[ConversableAgent], list[ConversableAgent], Optional[ConversableAgent], ContextVariables, ConversableAgent, TransitionTarget, GroupToolExecutor, GroupChat, GroupChatManager, list[dict[str, Any]], Any, list[str], list[Any]] | Tuple containing all necessary components for the group chat. |
Source code in autogen/agentchat/group/patterns/auto.py
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 |
|
create_default classmethod
#
create_default(initial_agent, agents, user_agent=None, group_manager_args=None, context_variables=None, exclude_transit_message=True, summary_method='last_msg')
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.
PARAMETER | DESCRIPTION |
---|---|
initial_agent | The first agent to speak in the group chat. TYPE: |
agents | List of all agents participating in the chat. TYPE: |
user_agent | Optional user proxy agent. TYPE: |
group_manager_args | Optional arguments for the GroupChatManager. |
context_variables | Initial context variables for the chat. TYPE: |
exclude_transit_message | Whether to exclude transit messages from the conversation. TYPE: |
summary_method | Method for summarizing the conversation. TYPE: |
RETURNS | DESCRIPTION |
---|---|
DefaultPattern | A DefaultPattern instance with basic configuration. |