Optimal partner function spaces are found for action of a general operator or embedding. Optimality is considered in the context of the rearrangement-invariant Banach function spaces.