HappyLoop / grafo

Asynchronous execution of tree structures.
MIT License
0 stars 0 forks source link

Agents Discussion #7

Open paulomtts opened 2 weeks ago

paulomtts commented 2 weeks ago

I'd like to discuss what is needed to build an Agent using Grafo. Agents have agency, and off the top of my head I can think of the following:

I'd love to hear your thoughts. @molinavinicius @1r4t4

paulomtts commented 3 days ago

From all that I've read so far I realized that it is better to limit the scope of an agent. If we try to build an agent that sees all and does all, there's too much room for error. We can, however, build an agent that tries to understand if it is capable of perform a task, see:

  1. InputSplitter: splits the user's input into list[Job]
  2. JobSplitter: receives a Job and a list[Tool] as input, and then build a list[Task]

The Task object should resemble this:

class Task(BaseModel):
    """
    A Task is a unit of work. If requires a tool to be performed. If no tools fit the requirements, then the Task cannot be done.
    """
    description: str = Field(..., description="<task-description-here>")
    tool: Optional[str] = Field(None, description="The name of the tool that can be used to perform this task.")
    priority: int = Field(..., description="A number representing this tasks position in the execution queue.")
    required: bool = Field(..., description="Whether this Task is required or optional for the parent Job's completion.")

When JobSplitter returns a list[Task] we will:

  1. Check if there are any Task whose .required=True and .tool=None. If YES, then fail the Job and return a message to the user, asking if he wants to proceed with other succesfully built jobs.
  2. If no job building failed, proceed to build a tree of nodes, where each node executes the tool chosen by a Task.

Let me know what you think.