I’m trying to use a conditional task with CrewAI (v0.102.0
) Flows.
Even if I set the condition
parameter to False
, as follows, the task is still executed.
Does anybody else have issues with conditional tasks being used with Flows?
@task
def my_task(self) -> ConditionalTask:
return ConditionalTask(
condition=False,
config=self.tasks_config["my_task"],
llm=LLM(
model="gpt-4o-mini",
),
expected_output="Expected output should be a Pydantic model of MyOutput type with xxxxx, xxxxx, and xxxxx properties.",
output_pydantic=MyOutput,
)
@tonykipkemboi @matt Are there any known issues with the SDK?
UPDATE
I tested a simple Python script without Flows. I took an example from the docs as a base.
First of all, it gives me the following error, meaning that setting the condition
parameter to False
is not the right way, but I wasn’t getting this error at all with Flows.
TypeError: ‘bool’ object is not callable
After creating a simple condition function as follows, the task was correctly skipped.
def my_condition(output: TaskOutput) -> bool:
return False
This makes me think that conditional tasks don’t even work with Flows?