Use caching

This PR enables the agent to fully utilize the `cache_image` function. Now `prepare_image` will check if the image is already cached, and only download/write the image if it is not cached.

Depends on #54.