Methods and systems for controlling analyte levels are described. An example method may include receiving a sensor measurement relating to an eye-mountable device. The method also may include determining an analyte concentration based on the one or more sensor measurements, and comparing the analyte concentration to a target analyte concentration. Based on the comparing, the method further may include providing instructions to a drug delivery device, where the instructions are configured to control a drug delivery rate by the drug delivery device.