Finite State Machine (FSM) Group Chat allows the user to constrain agent transitions.
allowed_or_disallowed_speaker_transitions
and speaker_transitions_type
.
allowed_or_disallowed_speaker_transitions
: is a dictionary with the type expectation of {Agent: [Agent]}
. The key refers to the source agent, while the value(s) in the list refers to the target agent(s). If none, a fully connection graph is assumed.speaker_transitions_type
: is a string with the type expectation of string, and specifically, one of [“allowed”, “disallowed”]. We wanted the user to be able to supply a dictionary of allowed or disallowed transitions to improve the ease of use. In the code base, we would invert the disallowed transition into a allowed transition dictionary allowed_speaker_transitions_dict
.GroupChat
in the AutoGen
framework. In this demonstration, if we consider each agent as a state, and each agent speaks according to certain conditions. For example, User always initiates the task first, followed by Planner creating a plan. Then Engineer and Executor work alternately, with Critic intervening when necessary, and after Critic, only Planner should revise additional plans. Each state can only exist at a time, and there are transition conditions between states. Therefore, GroupChat can be well abstracted as a Finite-State Machine (FSM).
system_messages
as “task” because every agent should know what it needs to do. In this example, each agent has the same task, which is to count in sequence.description
parameter, where I have used natural language to describe the transition conditions of the FSM. Because the manager knows which agents are available next based on the constraints of the graph, I describe in the description
field of each candidate agent when it can speak, effectively describing the transition conditions in the FSM.GroupChat
and a GroupChatManager
visualize_speaker_transitions_dict
from autogen.graph_utils
to visualize the various graphs.