Agent Group Chat in Semantic Kernel
image

Agent Group Chats in Semantic Kernel

Agent group chats in Semantic Kernel allow you to orchestrate conversations between multiple AI agents, each with its own role and instructions. This enables you to create complex workflows and automate tasks that require collaboration between different AI personalities.
An agent group chat is initiated by creating an AgentGroupChat instance and adding participating agents. You can then provide an initial message to start the conversation. The chat then proceeds according to the configured SelectionStrategy and TerminationStrategy.


Selection Strategy

The SelectionStrategy determines which agent gets to respond next in the conversation. This can be a simple round-robin approach or a more sophisticated strategy based on the conversation history and the agents' roles.
Semantic Kernel provides two built-in selection strategies:

  • RoundRobinSelectionStrategy: Agents take turns responding in the order they were added to the chat.
  • KernelFunctionSelectionStrategy: A KernelFunction is used to analyze the conversation history or other context and decide which agent should respond next. This allows for more dynamic and context-aware agent selection.


Termination Strategy

The TerminationStrategy defines the conditions under which the chat ends. This could be after a certain number of turns, when a specific goal is achieved, or when a particular agent provides a certain response.
Semantic Kernel offers these built-in termination strategies:

  • MaxTurnsTerminationStrategy:: The chat ends after a specified number of turns.
  • KernelFunctionTerminationStrategy: A KernelFunction is used to analyze the conversation history or other context and determine if the chat should terminate. This enables flexible and customizable termination conditions based on the conversation's content.


An unhandled error has occurred. Reload 🗙