from crewai import Task | |
from textwrap import dedent | |
# This is an example of how to define custom tasks. | |
# You can define as many tasks as you want. | |
# You can also define custom agents in agents.py | |
class CustomTasks: | |
def __tip_section(self): | |
return "If you do your BEST WORK, I'll give you a $10,000 commission!" | |
def task_1_name(self, agent, var1, var2): | |
return Task( | |
description=dedent( | |
f""" | |
Do something as part of task 1 | |
{self.__tip_section()} | |
Make sure to use the most recent data as possible. | |
Use this variable: {var1} | |
And also this variable: {var2} | |
""" | |
), | |
agent=agent, | |
) | |
def task_2_name(self, agent): | |
return Task( | |
description=dedent( | |
f""" | |
Take the input from task 1 and do something with it. | |
{self.__tip_section()} | |
Make sure to do something else. | |
""" | |
), | |
agent=agent, | |
) | |