Flik, an individualist and would-be inventor, lives in a colony of ants in the middle of a dried creek. They are led by Princess Atta and her mother, the Queen. The colony is oppressed by a gang of marauding grasshoppers, led by Hopper, that arrive every season demanding food from the ants. One day, when the annual offering is accidentally knocked into a stream by Flik's latest invention, a grain-harvesting device, the grasshoppers demand twice as much food as compensation. The ants trick Flik into accepting his plan to recruit "warrior bugs" to fight off the grasshoppers. While Flik actually believes in the plan, the other ants see it as an opportunity to get rid of Flik and save themselves trouble.Making his way to the "big city" (a heap of trash under a trailer), Flik mistakes a group of circus bugs that have recently been dismissed by their money-hungry ringmaster, P.T. Flea, for the warrior bugs he seeks. The bugs, in turn, mistake Flik for a talent agent and accept his offer to travel with him back to Ant Island. After they arrive, the circus bugs and Flik both discover their mutual misunderstandings during a welcome performance by the ants. The circus bugs then attempt to leave, but are forced back by a bird that attacks the group. They save Dot, Atta's younger sister, from the bird as they flee, gaining the ants' respect in the process. At Flik's insistence, they continue the ruse of being "warriors" so the troupe can continue to enjoy the attention and hospitality of the ants. The bird encounter inspires Flik into creating a false bird to scare away the grasshoppers. While the bird is being built, Hopper reveals to the other grasshoppers how greatly the ants outnumber them and worries that they will eventually turn on them.The bird is constructed, but during a celebration party, the truth about the circus bugs is revealed when P.T. Flea arrives searching for them. Outraged at Flik's deception, the ants exile him and desperately gather food for a new offering to the grasshoppers. When the grasshoppers discover the mediocre offering upon their arrival, they take control of the entire colony, demanding the ants' winter store of food. After overhearing Hopper's plan to kill the Queen, Dot leaves in search of Flik and the circus bugs and has them use the bird model to save the colony.The bird nearly works, but P.T. Flea, also mistaking it for a real bird, lights it on fire, exposing it as a decoy. Hopper beats Flik in retaliation, and proclaims that the ants are lowly life forms and live to serve the grasshoppers. However, Flik retorts that the ants are actually independent, without helping the grasshoppers. This inspires the entire colony along with the circus bugs to force the grasshoppers out of Ant Island. Hopper, refusing to flee, is taken by the ants to be disposed of, but it suddenly begins to rain. In the ensuing chaos among the ants, Hopper kidnaps Flik and flies off. Atta rescues Flik after the circus bugs fail to save him. As Hopper viciously pursues them, Flik leads him to the nest of the bird he encountered earlier. Mistaking the actual bird for another fake one, Hopper taunts it, before he is picked up by the bird and fed to her chicks.Some time later, Flik's inventions are finally perfected and appreciated by the ants, and Atta professes her love for Flik. The ants congratulate Flik as a hero and bid a fond farewell to the circus troupe, hoping that they will return for the following year. Atta is crowned the new queen and Dot is crowned the new heir to the throne.
Output: Question: Who do the ants gather food for?, Answer: The grasshoppers