Introducing CaptainAgent for Adaptive Team Building
TL;DR
- We introduce CaptainAgent, an agent equipped with the capability to adaptively assemble a team of agents through retrieval-selection-generation process to handle complex tasks via the
nested chat
conversation pattern in AG2. - CaptainAgent supports all types of
ConversableAgents
implemented in AG2.
Introduction
Given an ad-hoc task, dynamically assembling a group of agents capable of effectively solving the problem is a complex challenge. In many cases, we manually design and select the agents involved. In this blog, we introduce CaptainAgent, an intelligent agent that can autonomously assemble a team of agents tailored to meet diverse and complex task requirements. CaptainAgent iterates over the following two steps until the problem is successfully solved.
- (Step 1) CaptainAgent will break down the task, recommend several roles needed for each subtask, and then create a team of agents accordingly. Each agent in the team is either generated from scratch or retrieved and selected from an agent library if provided. Each of them will also be equipped with predefined tools retrieved from a tool library if provided.
- (Step 2) For each subtask, the corresponding team of agents will jointly solve it. Once it’s done, a summarization and reflection step will be triggered to generate a report based on the multi-agent conversation history. Based on the report, CaptainAgent will decide whether to adjust the subtasks and corresponding team (go to Step 1) or to terminate and output the results.
The design of CaptainAgent allows it to leverage agents and tools from a pre-specified agent library and tool library. In the following section, we demonstrate how to use CaptainAgent with or without the provided library.
To install AG2 with CaptainAgent:
Using CaptainAgent without pre-specified agent/tool libraries
CaptainAgent can serve as a drop-in replacement for the general AssistantAgent
class in AG2. It also allows customization such as agent/tool libraries. When the libraries are provided, CaptainAgent will try to leverage them when solving a task.
Without them, CaptainAgent will automatically generate new agents.
Using CaptainAgent with pre-specified agent/tool libraries
To use CaptainAgent with pre-specified agent/tool libraries, we just need to specify the path to the agent library and tool library. The two libraries are independent, so you can choose to use one of the libraries or both. The tool library we provide requires subscribing to specific APIs, please refer to the docs for details. The following example does not necessarily require tool usage, so it’s fine if you are subscribing to them.
To use agents from an agent library, you just need to specify a library_path
sub-field or a autobuild_tool_config
field in CaptainAgent’s configuration.
Further Reading
For a detailed description of how to configure the CaptainAgent, please refer to
Please also refer to our paper for more details about CaptainAgent and the proposed new team-building paradigm: adaptive build.
If you find this blog useful, please consider citing: