How to Run Agents Sequentially and Stop on Success?

Hi, Is there any method to stop further execution when the task is successfully completed in a sequential process in crewai.

For example, A and B are two sequential agents. If A is able to give output, the process should stop with Agent A else agent B should also be executed.