Skip to content

Agent

Available actions check

When you run the agent, we do a good faith effort to ensure that the inputs, outputs, and actions are compatible with one another.

This, for instance, will not run:

from conatus import Task
from conatus.actions.preloaded.html_actions import (
  html_find_all, get_attributes_from_list
)
from conatus.actions.preloaded.html_helpers import HTML
from conatus.agents.base import Agent

task = Task(
  "Get all the links from the page, and "
  "return the HTML documents and the links",
  name="get_links",
  actions=[html_find_all, get_attributes_from_list],
  outputs={"page": HTML, "links": list[str]},
  starting_variables=None,
)

We know this because :

  1. The agent will start with no variables defined.
  2. The user-provided actions html_find_all and get_attributes_from_list are compatible with one another.

Implementing new agents

-> Declarative way of defining the agent by sub-classing the different agent subclasses. -> Possibility to use generics to make the code more readable