I would like to introduce Fluidity (GitHub: AshT-Python/Fluidity & pip install fluidityai), a set of Python classes that makes AI workflow development particularly easy and intuitive.
It’s best to illustrate with an example:
w = Workflow(“Monarchs”)
t1 = Task(name=“King”, instructions=“Please give me the name of a famous king”, output_type=“string”)
t2 = Task(name=“Queen”, instructions=“Please give me the name of a famous queen”, output_type=“string”)
t3 = Task(name=“DOB”, instructions=“Please tell me the dates of birth of {King} and {Queen} in the format dd-Mmm-yyyy”, output_type=“dict”)
t4 = Task(name=“Older”, instructions=“Please tell me which of these two monarchs was older, given their dates of birth: {DOB}”)
t1.setNextTask(“Queen”)
t2.setNextTask(“DOB”)
t3.setNextTask(“Older”)
w.addTasks(t1, t2, t3, t4)
w.run(“King”) # Run workflow from specified task name
print(w.outputs()[“Older”]) # prints the name of the older monarch
Essentially you create a workflow and add tasks to it. Each task points to its next task - alternatively, branch objects can be added to the workflow to programmatically decide where to go next by setting the “next_task” pointer. This way potentially complex workflow graphs, which can include cycles, can be constructed easily. The output of any task can be accessed by subsequent tasks using {<task_name>} placeholders. A task can be python code instead of LLM instructions.