1. A method for generating an idempotent workflow comprising: detecting distributed code; identifying a boundary function in the distributed code; separating the boundary function into a transition function, a non-idempotent function, and a reversion function; transforming the non-idempotent function into an idempotent function by generating a flag corresponding to the non-idempotent function, wherein the flag indicates if the non-idempotent function has been executed; and combining the transition function, the idempotent function, and the reversion function to form the idempotent workflow.