This research addresses the hypothesis that behavioral context is encoded in recurrent networks of the fronto-striatal system. Behavioral context influences the processing of subsequent brain events, including responses to sensory inputs, thus providing a basis for context-dependent behavior. We define context-dependent behavior as the adaptive ability to produce the appropriate response to a given stimulus, dependent upon the context in which it appears. Behavioral context can change with a time-scale on the order of seconds to tens of seconds or more. This suggests a flexible mechanism that encodes context via an ensemble of neural activation that will appropriately influence the processing of subsequent sensory stimuli. We present a functional model of context encoding in recurrent connections of the fronto-striatal system with simulation results that correspond closely to empirical data. Neuronal activity in monkeys that perform a context-dependent task indicate that the prefrontal cortex and striatum participate differentially in this kind of context encoding. Likewise, simulated neurons in our model of the fronto-striatal system, which performs the context-dependent task, display task-related activity remarkably similar to that found in monkey frontal cortex and striatum, supporting our hypothesis.