An organism's ability to thrive in changing environmental conditions requires the capacity for making flexible behavioral responses. Here we show that, in the nematode Caenorhabditis elegans, foraging responses to changes in food availability require nlp-12, a homolog of the mammalian neuropeptide cholecystokinin (CCK). nlp-12 expression is limited to a single interneuron (DVA) that is postsynaptic to dopaminergic neurons involved in food-sensing, and presynaptic to locomotory control neurons. NLP-12 release from DVA is regulated through the D1-like dopamine receptor DOP-1, and both nlp-12 and dop-1 are required for normal local food searching responses. nlp-12/CCK overexpression recapitulates characteristics of local food searching, and DVA ablation or mutations disrupting muscle acetylcholine receptor function attenuate these effects. Conversely, nlp-12 deletion reverses behavioral and functional changes associated with genetically enhanced muscle acetylcholine receptor activity. Thus, our data suggest that dopamine-mediated sensory information about food availability shapes foraging in a context-dependent manner through peptide modulation of locomotory output.