Controlling the flow of mass and energy through living systems