Skip to content

Commit 4f74665

Browse files
Merge pull request #49858 from buzahid/sk-agents-updates
Modules/M05-orchestrate-sk-multi-agent-solution Added unit, updated content
2 parents 2fba429 + 62f3b44 commit 4f74665

16 files changed

+260
-126
lines changed

learn-pr/wwl-data-ai/.openpublishing.redirection.wwl-data-ai.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5020,6 +5020,26 @@
50205020
{
50215021
"source_path_from_root": "/learn-pr/wwl-data-ai/get-started-ai-fundamentals/8b-knowledge-check.yml",
50225022
"redirect_url": "/training/modules/get-started-ai-fundamentals/8-knowledge-check"
5023+
},
5024+
{
5025+
"source_path_from_root": "/learn-pr/wwl-data-ai/orchestrate-semantic-kernel-multi-agent-solution/3-design-agent-selection-strategy.yml",
5026+
"redirect_url": "/training/modules/orchestrate-semantic-kernel-multi-agent-solution/4-design-agent-selection-strategy"
5027+
},
5028+
{
5029+
"source_path_from_root": "/learn-pr/wwl-data-ai/orchestrate-semantic-kernel-multi-agent-solution/4-define-chat-termination-strategy.yml",
5030+
"redirect_url": "/training/modules/orchestrate-semantic-kernel-multi-agent-solution/5-define-chat-termination-strategy"
5031+
},
5032+
{
5033+
"source_path_from_root": "/learn-pr/wwl-data-ai/orchestrate-semantic-kernel-multi-agent-solution/5-exercise.yml",
5034+
"redirect_url": "/training/modules/orchestrate-semantic-kernel-multi-agent-solution/6-exercise"
5035+
},
5036+
{
5037+
"source_path_from_root": "/learn-pr/wwl-data-ai/orchestrate-semantic-kernel-multi-agent-solution/6-knowledge-check.yml",
5038+
"redirect_url": "/training/modules/orchestrate-semantic-kernel-multi-agent-solution/7-knowledge-check"
5039+
},
5040+
{
5041+
"source_path_from_root": "/learn-pr/wwl-data-ai/orchestrate-semantic-kernel-multi-agent-solution/7-summary.yml",
5042+
"redirect_url": "/training/modules/orchestrate-semantic-kernel-multi-agent-solution/8-summary"
50235043
}
50245044
]
50255045
}

learn-pr/wwl-data-ai/develop-ai-agent-with-semantic-kernel/6-knowledge-check.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,17 @@ durationInMinutes: 3
1212
content: |
1313
quiz:
1414
questions:
15-
- content: "What is the main purpose of the AzureAIAgent class in Semantic Kernel?"
15+
- content: "What are the key steps to create an AzureAIAgent?"
1616
choices:
17-
- content: "To provide a low-level interface for directly managing AI models"
17+
- content: "Initialize the agent by defining an LLM model in the AzureAIAgentThread constructor."
1818
isCorrect: false
19-
explanation: "Incorrect. The AzureAIAgent class is built on top of Azure AI Agent Service and streamlines its features rather than providing a low-level interface."
20-
- content: "To simplify the use of Azure AI Agent Service by abstracting complex operations"
19+
explanation: "Incorrect. The agent definition specifies the model, not the thread constructor."
20+
- content: "Create an Azure AI agents client, create an agent definition, and instantiate the agent."
2121
isCorrect: true
22-
explanation: "Correct. The AzureAIAgent class is designed to streamline the usage of Azure AI Agent Service, reducing the complexity of setting up and managing AI agents."
23-
- content: "To replace the need for prompt templates in AI workflows"
22+
explanation: "Correct. These steps ensure that the agent is correctly defined and can interact with Azure AI Foundry services."
23+
- content: "Deploy a custom AI model before creating an AzureAIAgentSettings object."
2424
isCorrect: false
25-
explanation: "Incorrect. AzureAIAgent enhances agent interactions but doesn't replace prompt templates, which are useful for defining structured AI behavior."
25+
explanation: "Incorrect. AzureAIAgent does not require deploying a custom AI model before setup."
2626
- content: "Which component in the Agent Framework manages conversation state and stores messages?"
2727
choices:
2828
- content: "Agent threads"
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
### YamlMime:ModuleUnit
2+
uid: learn.wwl.orchestrate-sk-multi-agent-solution.create-agent-group-chat
3+
title: Create an agent group chat
4+
metadata:
5+
title: Create an agent group chat
6+
description: Learn how to create an agent group chat for multi-agent collaboration.
7+
author: buzahid
8+
ms.author: buzahid
9+
ms.date: 03/14/2025
10+
ms.topic: unit
11+
durationInMinutes: 6
12+
content: |
13+
[!include[](includes/3-create-agent-group-chat.md)]
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ metadata:
1010
ms.topic: unit
1111
durationInMinutes: 1
1212
content: |
13-
[!include[](includes/3-design-agent-selection-strategy.md)]
13+
[!include[](includes/4-design-agent-selection-strategy.md)]
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ metadata:
1010
ms.topic: unit
1111
durationInMinutes: 6
1212
content: |
13-
[!include[](includes/4-define-chat-termination-strategy.md)]
13+
[!include[](includes/5-define-chat-termination-strategy.md)]

learn-pr/wwl-data-ai/orchestrate-semantic-kernel-multi-agent-solution/5-exercise.yml renamed to learn-pr/wwl-data-ai/orchestrate-semantic-kernel-multi-agent-solution/6-exercise.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ metadata:
1010
ms.topic: unit
1111
durationInMinutes: 30
1212
content: |
13-
[!include[](includes/5-exercise.md)]
13+
[!include[](includes/6-exercise.md)]

learn-pr/wwl-data-ai/orchestrate-semantic-kernel-multi-agent-solution/6-knowledge-check.yml renamed to learn-pr/wwl-data-ai/orchestrate-semantic-kernel-multi-agent-solution/7-knowledge-check.yml

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
### YamlMime:ModuleUnit
22
uid: learn.wwl.orchestrate-sk-multi-agent-solution.knowledge-check
3-
title: Module assessment
3+
title: Knowledge check
44
metadata:
5-
title: Module assessment
5+
title: Knowledge check
66
description: This unit contains a knowledge check which can help learners reinforce their understanding of the material.
77
author: buzahid
88
ms.author: buzahid
@@ -12,25 +12,25 @@ durationInMinutes: 3
1212
content: |
1313
quiz:
1414
questions:
15-
- content: "Which of the following options best describes an agent in the Semantic Kernel Agent Framework?"
16-
choices:
17-
- content: "A human-controlled interface for interacting with AI models"
18-
isCorrect: false
19-
explanation: "Incorrect. Agents in the framework aren't human-controlled; they're autonomous systems designed to process input and complete tasks."
20-
- content: "A storage system used to manage user data"
21-
isCorrect: false
22-
explanation: "Incorrect. Agents don't function as data storage systems; they perform tasks based on user interaction and intent."
23-
- content: "An autonomous system that interacts with users and performs specific tasks based on user input and intent."
24-
isCorrect: true
25-
explanation: "Correct. In the Semantic Kernel Agent Framework, agents are autonomous systems that interact with users, interpret input, and perform tasks tailored to the user's needs."
26-
- content: "How does the Semantic Kernel Agent Framework select the right agent for a task?"
15+
- content: "Which statement best describes AgentGroupChat in the Semantic Kernel AgentChat framework?"
16+
choices:
17+
- content: "It only supports interactions between agents of the same type."
18+
isCorrect: false
19+
explanation: "Incorrect. AgentGroupChat allows agents of different types, such as ChatCompletionAgent and OpenAIAssistantAgent, to work together."
20+
- content: "It is an abstract class that must be subclassed to enable multi-agent interactions."
21+
isCorrect: false
22+
explanation: "Incorrect. AgentGroupChat is a concrete implementation of AgentChat, not an abstract class."
23+
- content: "It enables interaction between multiple agents and uses strategy-based approaches to manage conversation dynamics."
24+
isCorrect: true
25+
explanation: "Correct. AgentGroupChat allows multiple agents to collaborate using strategy-based conversation management."
26+
- content: "In an agent group chat, how does the Semantic Kernel Agent Framework select the right agent for a task?"
2727
choices:
2828
- content: "By random selection"
2929
isCorrect: false
3030
explanation: "Incorrect. Agent selection isn't random; it's based on analyzing user intent and routing according to specific rules."
31-
- content: "Based on the user's intent and predefined rules"
31+
- content: "Using the specified selection strategy"
3232
isCorrect: true
33-
explanation: "Correct. The framework uses intent recognition and predefined rules to route queries to the most relevant agent."
33+
explanation: "Correct. The framework uses the defined selection strategy to determin which agent should respond."
3434
- content: "By the agent's physical location"
3535
isCorrect: false
3636
explanation: "Incorrect. Agent selection isn't based on physical location but on task relevance and expertise."

learn-pr/wwl-data-ai/orchestrate-semantic-kernel-multi-agent-solution/7-summary.yml renamed to learn-pr/wwl-data-ai/orchestrate-semantic-kernel-multi-agent-solution/8-summary.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ metadata:
1010
ms.topic: unit
1111
durationInMinutes: 2
1212
content: |
13-
[!include[](includes/7-summary.md)]
13+
[!include[](includes/8-summary.md)]
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
A key feature of the Semantic Kernel Agent Framework is its ability to facilitate interactions between multiple agents. Using `AgentGroupChat`, developers can create dynamic, multi-agent conversations where different types of agents collaborate to generate responses.
2+
3+
The `AgentGroupChat` class extends the AgentChat framework, providing a structured way to manage multi-agent collaboration. It offers built-in mechanisms to control conversation flow, define collaboration strategies, and support both single-turn and multi-turn interactions.
4+
5+
To create the `AgentGroupChat`, you can initialize the chat object with a predefined set of agents. For example:
6+
7+
```python
8+
# Define agents
9+
agent_writer = AzureAIAgent(...)
10+
agent_reviewer = AzureAIAgent(...)
11+
12+
# Create chat with participating agents
13+
chat = AgentGroupChat(agents=[agent_writer, agent_reviewer])
14+
```
15+
16+
Or you can start with an empty chat and add agents dynamically. For example:
17+
18+
```python
19+
# Create an empty chat
20+
chat = AgentGroupChat()
21+
22+
# Add agents to an existing chat
23+
chat.add_agent(agent=agent_writer)
24+
chat.add_agent(agent=agent_reviewer)
25+
```
26+
27+
## Add messages to the chat
28+
29+
Once your chat is created, you can create a `ChatMessageContent` object and add it to the chat thread. The `ChatMessageContent` object takes a role parameter in addition to the content. For example:
30+
31+
```python
32+
chat_message = ChatMessageContent(role=AuthorRole.USER, content="This is the message content.")
33+
await chat.add_chat_message(message=chat_message)
34+
```
35+
36+
### Conversation Modes in AgentGroupChat
37+
38+
Agent group chats can operate in two distinct modes, depending on the conversation requirements:
39+
40+
In **single-turn conversations**, a designated agent provides a response based on user input.
41+
42+
- You can invoke a response from a single-turn chat by using `AgentGroupChat.invoke` and specifying the agent that should respond. For example:
43+
44+
```python
45+
async for message in chat.invoke(agent)
46+
# process message response(s)
47+
```
48+
49+
In **multi-turn conversations**, multiple agents take turns responding, continuing the conversation until a termination condition is met.
50+
51+
- Agent responses are returned asynchronously as they are generated, allowing the conversation to unfold in real-time.
52+
53+
- You can invoke a response from a multi-turn chat by using `AgentGroupChat.invoke`. For example:
54+
55+
```python
56+
async for message in chat.invoke()
57+
# process message response(s)
58+
```
59+
60+
Both modes allow agents to collaborate by building on each other's responses, resulting in dynamic, intelligent interactions.

learn-pr/wwl-data-ai/orchestrate-semantic-kernel-multi-agent-solution/includes/3-design-agent-selection-strategy.md

Lines changed: 0 additions & 56 deletions
This file was deleted.

0 commit comments

Comments
 (0)