Let $X$ and $A$ be compact Polish spaces endowed with Borel $\sigma$-algebras. Let $\mathcal{A} = X\times \mathcal{B}(A)$ be the $\sigma$-algebra consisting of cylinders whose projections on $A$ are Borel sets. Let $u: X\times A\rightarrow\mathbb{R}$ be a continuous function. Let $\pi\in \Delta(X\times A)$ be a probability measure.
Let $\mathcal{F}\equiv \{f:A\rightarrow A|\;f \text{ is } \mathcal{A} \text{ measurable}\}$ denote the collection of all measurable functions from $A$ to $A$.
Question: Is it true that $$\sup_{f\in \mathcal{F}}\int_{X\times A} E \big[u\big(x,f(a)\big) \big| \mathcal{A}\big] d\pi(x,a) = \int_{X\times A}\; \sup_{f\in \mathcal{F}}E \big[u\big(x,f(a)\big) \big| \mathcal{A}\big] d\pi(x,a)?$$
An economic interpretation: As Michael Greinecker pointed out in the comment, if we interpret $u$ as the a payoff function, $x\in X$ as an unknown state, $a\in A$ as an action, and $\pi$ as a system of stochastic action recommendations, then the claim I am trying to establish can be interpreted as saying that choosing an optimal contingent plan ex ante leads to the same expected utility as maximizing for each recommended action at the interim stage.
My thoughts so far:
My first instinct is to invoke the Measurable Selection Theorem, which would be similar to the arguments in Theorem 14.60 of Rockafella and Wets' "Variational Analysis". However, I do not know how to work with the conditional expectations in the expression above, which is itself a random variable that is only unique almost surely.
Specifically, to use the Measurable Selection Theorem as Rockafellar and Wets did, I would need to somehow establish that $$ \Big\{k: E \big[u\big(x,k\big) \big| a\big] \ge c \Big\} $$ is a closed set for each $a\in A$ and $c\in \mathbb{R}$, but I'm not sure why that would be true, especially since conditional expectation is only pinned down for almost all $a\in A$.
Any pointers would be greatly appreciated!