In this paper we investigate the flexibility of foraging behavior in the leaf-cutting ant Atta colombica, both at the individual and collective levels, following a change in the physical properties of their environment. We studied in laboratory conditions the changes occurring in foraging behavior when a height constraint was placed 1 cm above part of the trail linking the nest to the foraging area. We found that the size and shape of the fragments of foraging material brought back to the nest were significantly modified when the constraint was placed on the trail: independent of their size, forager ants cut smaller and rounder fragments in the presence of a height constraint than in its absence. This size adjustment does not require any direct sensory feedback because it occurred when the ants cut fragments in the foraging area; no further cutting was done when they encountered the constraint. This points to the existence of a template that ants store and use as a reference to adjust their reach while cutting. Remarkably, despite the decrease in the foraging material brought to the nest per capita the colony was still able to improve its foraging performance by doubling the number of transporters. This study illustrates the flexibility of foraging behavior exhibited by an ant colony. It provides a rare example of insects finding an intelligent solution to a problem occurring in a foraging context, at both the individual and collective levels.