In an ecosystem, organisms play different roles in the flow of energy and nutrients. Decomposers are crucial for nutrient cycling by breaking down dead organic matter.