|
1 |
| -NOTES: After thinking on this longer, I wonder if we split out each section here into its own unit and expand a bit - give examples of the prebuilt selection and termination strategies. Then we can drop the code heavy unit (currently 4) and save the coding for the lab |
2 |
| - |
3 |
| - |
4 | 1 | A key part of the Semantic Kernel Agent Framework is a system designed to facilitate intelligent, multi-agent interactions. Agent collaboration, called `AgentGroupChat`, has critical components to consider that aren't necessary with single agents or non-agentic Semantic Kernel applications.
|
5 | 2 |
|
6 | 3 | Each of these sections discusses an example multi-agent solution, where we have two agents:
|
@@ -56,45 +53,4 @@ prompt=f"""
|
56 | 53 | """
|
57 | 54 | ```
|
58 | 55 |
|
59 |
| -If your preferred interaction should always have a certain agent respond first, that can be specified in your selection strategy as seen in the prompt above. |
60 |
| - |
61 |
| -Multi-turn conversations have responses returned asynchronously, so the conversation can develop naturally. However, the agents need to know when to stop a conversation, which is determined by the **termination strategy** |
62 |
| - |
63 |
| -## Termination strategy |
64 |
| - |
65 |
| -A termination strategy ensures that conversations or tasks conclude appropriately, preventing unnecessary messages to the user, limiting resource usage, and improving user experience. |
66 |
| - |
67 |
| -For example, once the _ReviewingDirectorAgent_ has reviewed and approved our scrubbing brush slogan from the _CopywriterAgent_, us humans know the conversation should be over. However, if we don't define when to terminate the conversation, the _CopywriterAgent_ is going to keep submitting slogans unnecessarily. |
68 |
| - |
69 |
| -### Why use a termination strategy? |
70 |
| - |
71 |
| -- **Efficiency**: It prevents endless loops or prolonged interactions, saving computational resources. |
72 |
| -- **User satisfaction**: Users receive concise and relevant responses, avoiding frustration from overly long conversations. |
73 |
| -- **Goal completion**: The use of an agent is to complete a task. By terminating appropriately. it confirms when a task or conversation has achieved its intended purpose. |
74 |
| - |
75 |
| -### How does the framework implement termination strategies? |
76 |
| - |
77 |
| -Similar to how the selection strategy is specified, developers can specify a termination strategy or use one of the predefined strategies. Termination strategies can also define a maximum number of iterations a conversation should be limited to. |
78 |
| - |
79 |
| -Termination strategies can be created by a prompt, such as: |
80 |
| - |
81 |
| -```python |
82 |
| -prompt=""" |
83 |
| - Determine if the copy has been approved. If so, respond with a single word: yes |
84 |
| -
|
85 |
| - History: |
86 |
| - {{$history}} |
87 |
| - """ |
88 |
| -``` |
89 |
| - |
90 |
| -You can also specify which agent should determine that termination, which in our case would be _ReviewingDirectorAgent_. The agents to determine termination are also defined in the `AgentGroupChat`. |
91 |
| - |
92 |
| -If it makes more sense for a given scenario, developers can also define termination functions explicitly in code. For example, we could define a termination function that checks the most recent history entry for just the word "yes". There are other use-case specific considerations if that route is chosen, such as very explicit agent instructions for approval, but it is an option. |
93 |
| - |
94 |
| -### Conversation state |
95 |
| - |
96 |
| -When a conversation is considered complete and terminates, the `AgentGroupChat` state is updated to _completed_. However, you may want to use the group chat instance again, in which you will need to reset the completion state to `False`. |
97 |
| - |
98 |
| -In the case of a conversation hitting the maximum number of iterations allowed, the conversation will end but will not be marked as _completed_. In this case, you are able to extend the conversation without resetting the conversation state. |
99 |
| - |
100 |
| -By understanding these components, you can better utilize the Semantic Kernel Agent Framework to build intelligent multi-agent systems. |
| 56 | +If your preferred interaction should always have a certain agent respond first, that can be specified in your selection strategy as seen in the prompt above. |
0 commit comments