From e4f8f362404aa115e1bb21ca2733ff2167df7fa2 Mon Sep 17 00:00:00 2001 From: Mark Sze Date: Tue, 19 Nov 2024 21:44:13 +0000 Subject: [PATCH] Move file and update blog --- website/blog/2024-11-17-Swarm/index.mdx | 22 ++++++++++++++----- .../using_swarm.ipynb => swarm.ipynb} | 2 +- 2 files changed, 18 insertions(+), 6 deletions(-) rename website/docs/topics/{groupchat/using_swarm.ipynb => swarm.ipynb} (99%) diff --git a/website/blog/2024-11-17-Swarm/index.mdx b/website/blog/2024-11-17-Swarm/index.mdx index 8d06e75924..33269c9ac2 100644 --- a/website/blog/2024-11-17-Swarm/index.mdx +++ b/website/blog/2024-11-17-Swarm/index.mdx @@ -1,19 +1,31 @@ -title: Building Swarm-based agents with AutoGen +title: Building Swarm-based agents with AG2 authors: - yiranwu - marklysze tags: [groupchat, swarm] --- -AutoGen Groupchat now supports a new speaker selection method, `swarm`, which allows quick implementation of the swarm orchestration from OpenAI's [Swarm](https://github.com/openai/swarm) framework. +AG2 now provides an implementation of the swarm orchestration from OpenAI's [Swarm](https://github.com/openai/swarm) framework with some additional features. -Here are two key features of the `swarm` speaker selection method: -- **Headoffs**: Agents can transfer control to another agent via function calls, enabling smooth transitions within workflows. -- **Context Variables**: Agents can dynamically update shared variables through function calls, maintaining context and adaptability throughout the process. +*Background*: the swarm orchestration is a multi-agent collaboration where agents execute tasks and are responsible for handing-off to other agents. +Here are two key features of the swarm orchestration: +- **Hand offs**: Agents can transfer control to another agent, enabling smooth and direct transitions within workflows. +- **Context Variables**: Agents can dynamically update a shared dictionary through function calls, maintaining context and adaptability throughout the process. + +In addition to the OpenAI implementation, AG2 provides: +- **Built-in human-in-the-loop**: Adding a user agent (UserProxyAgent) to your swarm will allow swarm agents to transition back to the user. Provides a means to clarify and confirm questions without breaking out of the swarm. +- **Fall-back agent**: The ability to automatically transition to a nominated swarm agent when an agent has completed their task. ## Getting Started +To create a swarm: +1. Define the functions that can be used by your `SwarmAgent`'s. +2. Create your `SwarmAgent`s (which derive from `ConversableAgent`). +3. For each agent, specify the hand-offs (transitions to another agent) and what to do when they have finished their work (termed *After Work*). + +UP TO HERE + The `swarm` speaker selection method needs to be used in conjunction with `SwarmAgent` and `SwarmResult` classes. Use the `initialize_swarm_chat` to get a swarm reply. ```python diff --git a/website/docs/topics/groupchat/using_swarm.ipynb b/website/docs/topics/swarm.ipynb similarity index 99% rename from website/docs/topics/groupchat/using_swarm.ipynb rename to website/docs/topics/swarm.ipynb index 30ddaf5bfe..ad9d812ec1 100644 --- a/website/docs/topics/groupchat/using_swarm.ipynb +++ b/website/docs/topics/swarm.ipynb @@ -4,7 +4,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "# Using Swarm Ochestration\n", + "# Swarm Ochestration\n", "\n", "You can set the speaker selection method to `swarm` to use the swarm-like orchestration.\n", "\n",