TaskSpecifyAgent

class TaskSpecifyAgent(ChatAgent):

An agent that specifies a given task prompt by prompting the user to provide more details.

Attributes: DEFAULT_WORD_LIMIT (int): The default word limit for the task prompt. task_specify_prompt (TextPrompt): The prompt for specifying the task.

Parameters:

  • model (BaseModelBackend, optional): The model backend to use for generating responses. (default: :obj:OpenAIModel with GPT_4O_MINI)
  • task_type (TaskType, optional): The type of task for which to generate a prompt. (default: :obj:TaskType.AI_SOCIETY)
  • task_specify_prompt (Union[str, TextPrompt], optional): The prompt for specifying the task. (default: :obj:None)
  • word_limit (int, optional): The word limit for the task prompt. (default: :obj:50)
  • output_language (str, optional): The language to be output by the agent. (default: :obj:None)

init

def __init__(
    self,
    model: Optional[BaseModelBackend] = None,
    task_type: TaskType = TaskType.AI_SOCIETY,
    task_specify_prompt: Optional[Union[str, TextPrompt]] = None,
    word_limit: int = DEFAULT_WORD_LIMIT,
    output_language: Optional[str] = None
):

run

def run(
    self,
    task_prompt: Union[str, TextPrompt],
    meta_dict: Optional[Dict[str, Any]] = None
):

Specify the given task prompt by providing more details.

Parameters:

  • task_prompt (Union[str, TextPrompt]): The original task prompt.
  • meta_dict (Dict[str, Any], optional): A dictionary containing additional information to include in the prompt. (default: :obj:None)

Returns:

TextPrompt: The specified task prompt.

TaskPlannerAgent

class TaskPlannerAgent(ChatAgent):

An agent that helps divide a task into subtasks based on the input task prompt.

Attributes: task_planner_prompt (TextPrompt): A prompt for the agent to divide the task into subtasks.

Parameters:

  • model (BaseModelBackend, optional): The model backend to use for generating responses. (default: :obj:OpenAIModel with GPT_4O_MINI)
  • output_language (str, optional): The language to be output by the agent. (default: :obj:None)

init

def __init__(
    self,
    model: Optional[BaseModelBackend] = None,
    output_language: Optional[str] = None
):

run

def run(self, task_prompt: Union[str, TextPrompt]):

Generate subtasks based on the input task prompt.

Parameters:

  • task_prompt (Union[str, TextPrompt]): The prompt for the task to be divided into subtasks.

Returns:

TextPrompt: A prompt for the subtasks generated by the agent.

TaskCreationAgent

class TaskCreationAgent(ChatAgent):

An agent that helps create new tasks based on the objective and last completed task. Compared to :obj:TaskPlannerAgent, it’s still a task planner, but it has more context information like last task and incomplete task list. Modified from BabyAGI <https://github.com/yoheinakajima/babyagi>_.

Attributes: task_creation_prompt (TextPrompt): A prompt for the agent to create new tasks.

Parameters:

  • role_name (str): The role name of the Agent to create the task.
  • objective (Union[str, TextPrompt]): The objective of the Agent to perform the task.
  • model (BaseModelBackend, optional): The LLM backend to use for generating responses. (default: :obj:OpenAIModel with GPT_4O_MINI)
  • output_language (str, optional): The language to be output by the agent. (default: :obj:None)
  • message_window_size (int, optional): The maximum number of previous messages to include in the context window. If None, no windowing is performed. (default: :obj:None)
  • max_task_num (int, optional): The maximum number of planned tasks in one round. (default: :obj:3)

init

def __init__(
    self,
    role_name: str,
    objective: Union[str, TextPrompt],
    model: Optional[BaseModelBackend] = None,
    output_language: Optional[str] = None,
    message_window_size: Optional[int] = None,
    max_task_num: Optional[int] = 3
):

run

def run(self, task_list: List[str]):

Generate subtasks based on the previous task results and incomplete task list.

Parameters:

  • task_list (List[str]): The completed or in-progress tasks which should not overlap with new created tasks.

Returns:

List[str]: The new task list generated by the Agent.

TaskPrioritizationAgent

class TaskPrioritizationAgent(ChatAgent):

An agent that helps re-prioritize the task list and returns numbered prioritized list. Modified from BabyAGI <https://github.com/yoheinakajima/babyagi>_.

Attributes: task_prioritization_prompt (TextPrompt): A prompt for the agent to prioritize tasks.

Parameters:

  • objective (Union[str, TextPrompt]): The objective of the Agent to perform the task.
  • model (BaseModelBackend, optional): The LLM backend to use for generating responses. (default: :obj:OpenAIModel with GPT_4O_MINI)
  • output_language (str, optional): The language to be output by the agent. (default: :obj:None)
  • message_window_size (int, optional): The maximum number of previous messages to include in the context window. If None, no windowing is performed. (default: :obj:None)

init

def __init__(
    self,
    objective: Union[str, TextPrompt],
    model: Optional[BaseModelBackend] = None,
    output_language: Optional[str] = None,
    message_window_size: Optional[int] = None
):

run

def run(self, task_list: List[str]):

Prioritize the task list given the agent objective.

Parameters:

  • task_list (List[str]): The unprioritized tasks of agent.

Returns:

List[str]: The new prioritized task list generated by the Agent.