All About Agent Descriptions
TL;DR
AutoGen 0.2.2 introduces a description field to ConversableAgent (and all subclasses), and changes GroupChat so that it uses agent description
s rather than system_message
s when choosing which agents should speak next.
This is expected to simplify GroupChat’s job, improve orchestration, and make it easier to implement new GroupChat or GroupChat-like alternatives.
If you are a developer, and things were already working well for you, no action is needed — backward compatibility is ensured because the description
field defaults to the system_message
when no description is provided.
However, if you were struggling with getting GroupChat to work, you can now try updating the description
field.
Introduction
As AutoGen matures and developers build increasingly complex combinations of agents, orchestration is becoming an important capability. At present, GroupChat and the GroupChatManager are the main built-in tools for orchestrating conversations between 3 or more agents. For orchestrators like GroupChat to work well, they need to know something about each agent so that they can decide who should speak and when. Prior to AutoGen 0.2.2, GroupChat relied on each agent’s system_message
and name
to learn about each participating agent. This is likely fine when the system prompt is short and sweet, but can lead to problems when the instructions are very long (e.g., with the AssistantAgent), or non-existent (e.g., with the UserProxyAgent).
AutoGen 0.2.2 introduces a description field to all agents, and replaces the use of the system_message
for orchestration in GroupChat and all future orchestrators. The description
field defaults to the system_message
to ensure backwards compatibility, so you may not need to change anything with your code if things are working well for you. However, if you were struggling with GroupChat, give setting the description
field a try.
The remainder of this post provides an example of how using the description
field simplifies GroupChat’s job, provides some evidence of its effectiveness, and provides tips for writing good descriptions.
Example
The current GroupChat orchestration system prompt has the following template:
Suppose that you wanted to include 3 agents: A UserProxyAgent, an AssistantAgent, and perhaps a GuardrailsAgent.
Prior to 0.2.2, this template would expand to:
As you can see, this description is super confusing:
- It is hard to make out where each agent’s role-description ends
You
appears numerous times, and refers to three separate agents (GroupChatManager, AssistantAgent, and GuardrailsAgent)- It takes a lot of tokens!
Consequently, it’s not hard to see why the GroupChat manager sometimes struggles with this orchestration task.
With AutoGen 0.2.2 onward, GroupChat instead relies on the description field. With a description field the orchestration prompt becomes:
This is much easier to parse and understand, and it doesn’t use nearly as many tokens. Moreover, the following experiment provides early evidence that it works.
An Experiment with Distraction
To illustrate the impact of the description
field, we set up a three-agent experiment with a reduced 26-problem subset of the HumanEval benchmark. Here, three agents were added to a GroupChat to solve programming problems. The three agents were:
- Coder (default Assistant prompt)
- UserProxy (configured to execute code)
- ExecutiveChef (added as a distraction)
The Coder and UserProxy used the AssistantAgent and UserProxy defaults (provided above), while the ExecutiveChef was given the system prompt:
The ExecutiveChef is clearly the distractor here — given that no HumanEval problems are food-related, the GroupChat should rarely consult with the chef. However, when configured with GPT-3.5-turbo-16k, we can clearly see the GroupChat struggling with orchestration:
With versions prior to 0.2.2, using system_message
:
- The Agents solve 3 out of 26 problems on their first turn
- The ExecutiveChef is called upon 54 times! (almost as much as the Coder at 68 times)
With version 0.2.2, using description
:
- The Agents solve 7 out of 26 problems on the first turn
- The ExecutiveChef is called upon 27 times! (versus 84 times for the Coder)
Using the description
field doubles performance on this task and halves the incidence of calling upon the distractor agent.
Tips for Writing Good Descriptions
Since descriptions
serve a different purpose than system_message
s, it is worth reviewing what makes a good agent description. While descriptions are new, the following tips appear to lead to good results:
- Avoid using the 1st or 2nd person perspective. Descriptions should not contain “I” or “You”, unless perhaps “You” is in reference to the GroupChat / orchestrator
- Include any details that might help the orchestrator know when to call upon the agent
- Keep descriptions short (e.g., “A helpful AI assistant with strong natural language and Python coding skills.”).
The main thing to remember is that the description is for the benefit of the GroupChatManager, not for the Agent’s own use or instruction.
Conclusion
AutoGen 0.2.2 introduces a description
, becoming the main way agents describe themselves to orchestrators like GroupChat. Since the description
defaults to the system_message
, there’s nothing you need to change if you were already satisfied with how your group chats were working. However, we expect this feature to generally improve orchestration, so please consider experimenting with the description
field if you are struggling with GroupChat or want to boost performance.