in generators/backend/templates/src/backend/patterns/debate.py [0:0]
def create_selection_strategy(self, agents, default_agent):
"""
Creates a strategy to determine which agent speaks next in the conversation.
Uses the executor model to analyze conversation context and select the most
appropriate next speaker based on the conversation history.
Args:
agents: List of available agents in the conversation.
default_agent: The fallback agent to use if selection fails.
Returns:
KernelFunctionSelectionStrategy: A strategy for selecting the next speaker.
"""
definitions = "\n".join([f"{agent.name}: {agent.description}" for agent in agents])
selection_function = KernelFunctionFromPrompt(
function_name="SpeakerSelector",
prompt_execution_settings=self.settings_executor,
prompt=fr"""