The ability to flexibly switch our response to external stimuli according to contextual information is critical for successful interactions with a complex world. Context-dependent computations are necessary across many domains, yet their neural implementations remain poorly understood. Here we developed a novel behavioral task in rats to study context-dependent selection and accumulation of evidence for decision-making. Under assumptions supported by both monkey and rat data, we first show mathematically that a network can solve this problem through a combination of three defined components. These components can be identified and tested directly with experimental data. We further show that existing electrophysiological and modeling data are compatible with the full variety of possible combinations of these components, suggesting that different individuals could use different component combinations. To study variability across individual subjects, we developed automated, high-throughput methods to train rats on our task, and we trained many subjects on it. Consistent with theoretical predictions, neural and behavioral analyses revealed substantial heterogeneity across rats, despite uniformly good task performance. Our theory further predicts a specific link between behavioral and neural signatures, which was robustly supported in the data. In summary, our results provide a new experimentally-supported theoretical framework to analyze individual variability in biological and artificial systems performing flexible decision-making tasks, they open the door to cellular-resolution studies of individual variability in higher cognition, and they provide insights into neural mechanisms of context-dependent computation more generally.