Integrating individual actions into coherent, organised behavioural units, a process called chunking, is a fundamental, evolutionarily conserved process that renders actions automatic. In vertebrates, evidence points to the basal ganglia – a complex network believed to be involved in action selection – as a key component of action sequence encoding, although the underlying mechanisms are only just beginning to be understood. Central pattern generators control many innate automatic behavioural sequences that form some of the most basic behaviours in an animal’s repertoire, and in vertebrates, brainstem and spinal pattern generators are under the control of higher order structures such as the basal ganglia. Evidence suggests that the basal ganglia play a crucial role in the concatenation of simpler behaviours into more complex chunks, in the context of innate behavioural sequences such as chain grooming in rats, as well as sequences in which innate capabilities and learning interact such as birdsong, and sequences that are learned from scratch, such as lever press sequences in operant behaviour. It has been proposed that the role of the striatum, the largest input structure of the basal ganglia, might lie in selecting and allowing the relevant central pattern generators to gain access to the motor system in the correct order, while inhibiting other behaviours. As behaviours become more complex and flexible, the pattern generators seem to become more dependent on descending signals. Indeed, during learning, the striatum itself may adopt the functional characteristics of a higher order pattern generator, facilitated at the microcircuit level by striatal neuropeptides.