Revert "Revert "Fixed agility.py issue""

This reverts commit 3e02e080cf485e254f820f75d7591c32c1b3a145.