Skip to main content
Version: 1.0

aixplain.modules.agent.agent_task

AgentTask Objects

class AgentTask()

[view_source]

A task definition for an AI agent to execute.

This class represents a task that can be assigned to an agent, including its description, expected output, and any dependencies on other tasks.

Attributes:

  • name Text - The unique identifier/name of the task.
  • description Text - Detailed description of what the task should accomplish.
  • expected_output Text - Description of the expected output format or content.
  • dependencies Optional[List[Union[Text, AgentTask]]] - List of tasks or task names that must be completed before this task. Defaults to None.

__init__

def __init__(name: Text,
description: Text,
expected_output: Text,
dependencies: Optional[List[Union[Text, "AgentTask"]]] = None)

[view_source]

Initialize a new AgentTask instance.

Arguments:

  • name Text - The unique identifier/name of the task.
  • description Text - Detailed description of what the task should accomplish.
  • expected_output Text - Description of the expected output format or content.
  • dependencies Optional[List[Union[Text, AgentTask]]], optional - List of tasks or task names that must be completed before this task. Defaults to None.

to_dict

def to_dict() -> dict

[view_source]

Convert the task to a dictionary representation.

This method serializes the task data, converting any AgentTask dependencies to their name strings.

Returns:

  • dict - A dictionary containing the task data with keys:
    • name: The task name
    • description: The task description
    • expectedOutput: The expected output description
    • dependencies: List of dependency names or None

from_dict

@classmethod
def from_dict(cls, data: dict) -> "AgentTask"

[view_source]

Create an AgentTask instance from a dictionary representation.

Arguments:

  • data - Dictionary containing AgentTask parameters

Returns:

AgentTask instance