How to Create Multi-Agent Workflows with AutoGen Studio
If you are interested in building powerful AI agents that can learn, adapt, and collaborate, you might have heard of AutoGen, an open-source framework for orchestrating the power of agents.
What is AutoGen?
AutoGen allows you to create conversable agents powered by language models, tools, or humans, and use them to perform tasks collectively via automated chat. You can also teach your agents new skills, use them to generate creative content, and explore cutting-edge enhancements in group chat dynamics, decision-making, and complex task proficiency.
What is AutoGen Studio?
However, you might wonder how to get started with AutoGen and how to create and manage your own multi-agent workflows. That’s where AutoGen Studio comes in. AutoGen Studio is a user-friendly interface that allows you to rapidly prototype and interact with multi-agent solutions for your tasks. It is powered by AutoGen, but it abstracts away the code and lets you focus on the design and the interaction of your agents.
In this blog post, I will show you how to use AutoGen Studio to create and interact with multi-agent workflows. I will also give you some examples of what you can do with AutoGen Studio and AutoGen.
Getting Started with AutoGen Studio
Before you can use AutoGen Studio, you need to install it via pip and configure an LLM provider. You can use either OpenAI or Azure as your LLM provider and specify the model and the API key in your environment or in the agent’s configuration. You can find more details on how to do this in the AutoGen documentation.
Once you have set up your LLM provider, you can install AutoGen Studio with the following command:
pip install autogenstudio
Note: We recommend installing Conda and create a virtual environment.
You can then launch AutoGen Studio from your terminal with the following command:
autogenstudio ui --port 8081
This will open a web browser window with the AutoGen Studio interface.
Creating and Modifying Agents and Multi-Agent Workflows
The AutoGen Studio interface consists of three main sections: the agent panel, the workflow panel, and the chat panel.
The Agent Panel
The agent panel allows you to create and modify agents. You can select the parameters of the agents, such as their names, roles, skills, and language models. You can also specify how the agents communicate and coordinate with each other to solve your task.
The Workflow Panel
The workflow panel allows you to create and modify multi-agent workflows. You can drag and drop agents from the agent panel to the workflow panel and connect them with arrows to indicate the flow of the conversation. You can also add conditions and loops to the workflow to make it more dynamic and flexible.
The Chat Panel
The chat panel allows you to create and interact with chat sessions with the specified agents and view the results. You can see the chat history, the generated files, and the time taken by the agents. You can also provide feedback to the agents and teach them new skills using the generic teachability mechanism in AutoGen.
Adding Skills to Your Agents and Accomplishing More Tasks
One of the powerful features of AutoGen Studio is that you can explicitly add skills to your agents and accomplish more tasks. For example, you can add the skill of generating PDF documents with images, or the skill of creating graphical artworks based on text prompts. You can also combine skills from different agents to create more complex workflows.
How to Add a Skill to an Agent?
To add a skill to an agent, you need to specify the name of the skill, the input and output types, and the function that implements the skill. You can use the predefined functions in AutoGen, such as graphic_art
or pdf_generator
, or you can write your own custom functions in Python. You can also use external tools or APIs as functions, as long as they are compatible with AutoGen.
How to Use a Skill in Chat Session?
To use a skill in a chat session, you need to invoke the skill with the appropriate input and output arguments. You can use the @
symbol to refer to an agent or a skill, and the #
symbol to refer to a variable or a file. For example, you can use the following command to ask an agent named Alice
to generate a PDF document with an image:
@Alice: pdf_generator(#image, #document)
This will invoke the pdf_generator
skill of Alice
with the input #image
and the output #document
. The #image
and #document
are variables that store the file names of the image and the PDF document, respectively. You can also use literal values as inputs or outputs, such as "a dragon"
or "dragon.pdf"
.
Publishing and Importing Sessions to a Local Gallery
Another useful feature of AutoGen Studio is that you can publish your sessions to a local gallery and share them with others. You can also import sessions from the gallery and modify them according to your needs.
How to Publish a Session to the Gallery?
To publish a session to the gallery, you need to click on the Publish
button on the chat panel and enter a name and a description for your session. This will save your session to a local folder called autogen_sessions
. You can then share this folder with others or upload it to a cloud storage service.
How to Import a Session from the Gallery?
To import a session from the gallery, you need to click on the Gallery
button on the chat panel and select a session from the list. This will load the session to the chat panel and the workflow panel. You can then interact with the session or modify it as you wish.
Examples of What You Can Do with AutoGen Studio and AutoGen
To give you some inspiration of what you can do with AutoGen Studio and AutoGen, here are some examples of multi-agent workflows that you can create and interact with:
- You can create a workflow that involves two agents, one that generates code and one that executes and debugs it. You can ask the code generator agent to write a program that solves a given problem, and then ask the code executor agent to run and test it. You can also provide feedback and suggestions to the agents to improve their code quality and performance.
- You can create a workflow that involves three agents, one that collects data from various sources, one that processes and cleans the data, and one that analyzes and visualizes the data. You can ask the data collector agent to fetch data from websites, databases, or APIs, and then ask the data processor agent to filter, transform, and merge the data. You can then ask the data analyzer agent to perform statistical or machine learning analysis on the data and generate charts or graphs.
- You can create a workflow that involves four agents, one that manages a group chat, and three that participate in the chat. You can ask the manager agent to assign roles and tasks to the other agents, and then ask the chat participants to collaborate and communicate with each other to solve the tasks. You can also join the chat as a human user and interact with the agents.
These are just some of the examples of what you can do with AutoGen Studio and AutoGen. You can find more examples and tutorials on the AutoGen website and the AutoGen GitHub repository.
Conclusion
In this blog post, I showed you how to use AutoGen Studio to create and interact with multi-agent workflows. I hope you found it useful and interesting.
Thank you for reading this blog post. If you have any questions or feedback, please comment below.