You can do all the programming on the Pi in Python. According to what I read you can enable/disable the relays with web requests like:
http://192.168.1.4/30000/00 : Relay-01 OFF
http://192.168.1.4/30000/01 : Relay-01 ON
So you can use the urllib to make the requests and MQTT to communicate with Cayenne.