Multi state machine for declarative async logic.