Loops in a flow

Hello community,

I want to create a simple flow which iterates 3 times before printing a final result. By some reason it does it only once. I would assume this is a normal behavior unless I see the example ‘self_evaluation_loop_flow’. I honestly do not understand the difference and a bit stuck. Can you please help?

Here is my code:

class MyFlowState(BaseModel):
retry_attempts_count: int = 0

class MyFlow(Flow[MyFlowState]):

@start("try_again")
def start_function(self):
    print("Start")

@router(start_function)
def check_attempts(self):
    if self.state.retry_attempts_count > 3:
        return "max_retry_exceeded"

    self.state.retry_attempts_count += 1
    return "try_again"

@listen("max_retry_exceeded")
def max_retry_exceeded_exit(self):
    print("Max retry count exceeded")


Thank you,
Andy