Jeff explains how AI agents can generalize tasks by being trained on parameterized environments, allowing them to adapt to new challenges like capture the flag. By presenting the agent with a description of the task, it learns to navigate and solve complex scenarios it has never encountered before. The discussion draws parallels to previous work on Nethack, highlighting the evolution of environment specification in AI.