Skip to content

Commit

Permalink
Move file and update blog
Browse files Browse the repository at this point in the history
  • Loading branch information
marklysze committed Nov 19, 2024
1 parent 2318335 commit e4f8f36
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
22 changes: 17 additions & 5 deletions website/blog/2024-11-17-Swarm/index.mdx
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit e4f8f36

Please sign in to comment.