acoustic-parrot-22802
10/06/2025, 9:20 AMancient-wolf-19325
10/06/2025, 9:20 AMfrom flytekit import task, workflow, conditional
@task
def T1() -> int:
# your logic
return 1
@task
def T2(x: int) -> bool:
# your logic
return x == 1
@task
def T3() -> str:
return "T3 executed"
@workflow
def my_wf() -> str:
t1_out = T1()
t2_out = T2(x=t1_out)
return (
conditional("run_t3")
.if_(t2_out.is_true())
.then(T3())
.else_()
.then("T3 skipped")
)
This pattern is the recommended way to branch workflow execution based on a task's output in Flyte. For more, see the Flyte conditionals documentation.
Would you like more detail or explanation?
Sources:
- Flyte conditionals documentation
- Flyte conditionals example 👍 0 button 👎 0 button 💡 Hint: Mention @runllm in the thread for followups.