Given an irreducible cuspidal automorphic represnetation, then it has character, i.e. the following operator is trace class $$ \pi(f) : v \mapsto \int\limits_{G(A)} f(g) \pi(g) v.$$ Note that $$ tr \pi(f) = \sum\limits <v, \pi(f) v> $$ of course. So this guarantees convergence. Now, if you assume that $f$ is smooth in the sense that it is invariant from the right and the left by an irreudicble representation of a maximal compact subgroup it will indeed be a finite sum for an apropriately chosen basis. These project onto the corresponding $K$-type. Automorphic representations factor into local smooth admisibleadmissible representations. I am not so sure why your using functions instead of vectors.