$\begin{array}{l}\text { 4. } \frac{3 \pi-6}{4} \text {. } \\ \text { Given } \tan ^{2}(\alpha+\beta)+\cot ^{2}(\alpha+\beta) \geqslant 2 \text {, } \\ 3 \alpha-\alpha^{2}-\frac{1}{4} \leqslant 2, \\ \text { then } \tan ^{2}(\alpha+\beta)+\cot ^{2}(\alpha+\beta) \\ =3 \alpha-\alpha^{2}-\frac{1}{4}=2 \text {. } \\ \text { Therefore, } \alpha=\frac{3}{2}, \alpha+\beta=\frac{3 \pi}{4} \text {. } \\ \text { Hence, } \beta=\frac{3 \pi-6}{4} \text {. }\end{array}$
4. Given $\alpha, \beta \in\left(0, \frac{\pi}{2}\right)$, and
$$
\tan ^{2}(\alpha+\beta)+\cot ^{2}(\alpha+\beta)=3 \alpha-\alpha^{2}-\frac{1}{4} \text {. }
$$

then $\beta=$ . $\qquad$