Skip to main content
CaptainAgent is an agent enhanced with the capability to call AutoBuild to break down and solve complex tasks. AutoBuild can initiate a group chat between a group of experts and converse to solve the task. The experts in nested chat can be retrieved from agent library. The agents can be equipped with tools for advanced coding. Install AG2 with the CaptainAgent extra.
If you have been using autogen or ag2, all you need to do is upgrade it using:
or
as autogen and ag2 are aliases for the same PyPI package.

Using CaptainAgent without libraries

We begin with demonstrating how to use CaptainAgent without retrieving from libraries. In this case, CaptainAgent will automatically generate a set of experts according to its identified subtask and initiate the group chat. By default, the backbone of the LLM is set to gpt-4o. For instructions on configuring the backbone, refer to docs on nested_mode.

Building Agents from library & Retrieve tools from tool library

One significant feature of CaptainAgent is that the agents and tools can be retrieved from a dedicated library. When CaptainAgent starts building experts for group chat, it will retrieve and select from agent library, then assign tools retrieved from tool library to the experts. For agent library, refer to captainagent_expert_library.json for samples. You can refer to docs on how to customize your own expert library. For tool library, we provide a set of tools here, the tools are categorized into three types: data analysis, information_retrieval, math. If you are using the tools, you should install the requirements for them.

Using Agent Library Only

Below is an example that retrieves experts from library and build nested chat accordingly.

Using Both Agent Library and Tool Library

Now let’s retrieve from both agent library and tool library while building experts for nested chat. To run the following demo, it is required to install the dependencies from the tool library and obtain BING search api and Rapid API key for tools in library to fully function. Please follow the instructions here.
The ground truth answer to the question is ‘Extremely’, which the CaptainAgent answers correctly. Notably, with the assistance of tools, the agent can answer video-related questions. This shows the huge potential of what user customized tools can bring.