autogen.agentchat.contrib.captainagent.AgentBuilder
AgentBuilder
AgentBuilder can help user build an automatic task solving process powered by multi-agent system.
Specifically, our building pipeline includes initialize and build.
(These APIs are experimental and may change in the future.)
Name | Description |
---|---|
config_file_or_env | Type: str | None Default: ‘OAI_CONFIG_LIST’ |
config_file_location | Type: str | None Default: ” |
builder_model | Type: str | list | None Default: [] |
agent_model | Type: str | list | None Default: [] |
builder_model_tags | Type: list | None Default: [] |
agent_model_tags | Type: list | None Default: [] |
max_agents | Type: int | None Default: 5 |
Class Attributes
AGENT_DESCRIPTION_PROMPT
AGENT_NAME_PROMPT
AGENT_SEARCHING_PROMPT
AGENT_SELECTION_PROMPT
AGENT_SYS_MSG_PROMPT
CODING_AND_TASK_SKILL_INSTRUCTION
CODING_PROMPT
DEFAULT_DESCRIPTION
DEFAULT_PROXY_AUTO_REPLY
GROUP_CHAT_DESCRIPTION
online_server_name
Instance Methods
build
Auto build agents based on the building task.
Name | Description |
---|---|
building_task | instruction that helps build manager (gpt-4) to decide what agent should be built. Type: str |
default_llm_config | specific configs for LLM (e.g., config_list, seed, temperature, …). Type: dict[str, typing.Any] |
coding | use to identify if the user proxy (a code interpreter) should be added. Type: bool | None Default: None |
code_execution_config | specific configs for user proxy (e.g., last_n_messages, work_dir, …). Type: dict[str, typing.Any] | None Default: None |
use_oai_assistant | use OpenAI assistant api instead of self-constructed agent. Type: bool | None Default: False |
user_proxy | user proxy’s class that can be used to replace the default user proxy. Type: ConversableAgent | None Default: None |
max_agents | Type: int | None Default: None |
**kwargs | Type: Any |
Type | Description |
---|---|
tuple[list[ConversableAgent], dict[str, typing.Any]] | agent_list: a list of agents. cached_configs: cached configs. |
build_from_library
Build agents from a library.
The library is a list of agent configs, which contains the name and system_message for each agent.
We use a build manager to decide what agent in that library should be involved to the task.
Name | Description |
---|---|
building_task | instruction that helps build manager (gpt-4) to decide what agent should be built. Type: str |
library_path_or_json | path or JSON string config of agent library. Type: str |
default_llm_config | specific configs for LLM (e.g., config_list, seed, temperature, …). Type: dict[str, typing.Any] |
top_k | Type: int Default: 3 |
coding | use to identify if the user proxy (a code interpreter) should be added. Type: bool | None Default: None |
code_execution_config | specific configs for user proxy (e.g., last_n_messages, work_dir, …). Type: dict[str, typing.Any] | None Default: None |
use_oai_assistant | use OpenAI assistant api instead of self-constructed agent. Type: bool | None Default: False |
embedding_model | a Sentence-Transformers model use for embedding similarity to select agents from library. As reference, chromadb use “all-mpnet-base-v2” as default. Type: str | None Default: ‘all-mpnet-base-v2’ |
user_proxy | user proxy’s class that can be used to replace the default user proxy. Type: ConversableAgent | None Default: None |
**kwargs | Type: Any |
Type | Description |
---|---|
tuple[list[ConversableAgent], dict[str, typing.Any]] | agent_list: a list of agents. cached_configs: cached configs. |
clear_agent
Clear a specific agent by name.
Name | Description |
---|---|
agent_name | the name of agent. Type: str |
recycle_endpoint | trigger for recycle the endpoint server. If true, the endpoint will be recycled when there is no agent depending on. Type: bool | None Default: True |
clear_all_agents
Clear all cached agents.
Parameters:Name | Description |
---|---|
recycle_endpoint | Type: bool | None Default: True |
load
Load building configs and call the build function to complete building without calling online LLMs’ api.
Name | Description |
---|---|
filepath | filepath or JSON string for the save config. Type: str | None Default: None |
config_json | JSON string for the save config. Type: str | None Default: None |
use_oai_assistant | use OpenAI assistant api instead of self-constructed agent. Type: bool | None Default: False |
**kwargs | Type: Any |
Type | Description |
---|---|
tuple[list[ConversableAgent], dict[str, typing.Any]] | agent_list: a list of agents. cached_configs: cached configs. |
save
Save building configs. If the filepath is not specific, this function will create a filename by encrypt the
building_task string by md5 with “save_config_” prefix, and save config to the local path.
Name | Description |
---|---|
filepath | save path. Type: str | None Default: None |
set_agent_model
Name | Description |
---|---|
model | Type: str |
set_builder_model
Name | Description |
---|---|
model | Type: str |