Let K be a field of characteristic zero, let A, B be K -algebras with polynomial identity and let M be a free ( A, B)-bimodule. The algebra R= A 0 M B can be endowed with a natural Z 2 -grading. In this paper, we compute the graded cocharacter sequence, the graded codimension sequence and the superexponent of R. As a consequence of these results, we also study the above PI-invariants in the setting of upper triangular matrices. In particular, we completely classify the algebra of 3×3 upper triangular matrices endowed with all possible Z 2 -gradings.