4. The three sides of a triangle are exactly $m^{2}+m+1, 2m+1, m^{2}-1$, then the largest angle in this triangle is
4. $\frac{2 \pi}{3}$ Detailed Explanation: From $m^{2}+m+1>0, 2 m+1>0, m^{2}-1>0$, we get $m>1$.

It is easy to determine that $m^{2}+m+1>2 m+1, m^{2}+m+1>m^{2}-1$,
$\therefore m^{2}+m+1$ is the largest side of the triangle, let its opposite angle be $\alpha(0<\alpha<\pi)$,
$$
\begin{array}{l}
\text { Then } \cos \alpha=\frac{(2 m+1)^{2}+\left(m^{2}-1\right)^{2}-\left(m^{2}+m+1\right)^{2}}{2(2 m+1)\left(m^{2}-1\right)} . \\
=\frac{(2 m+1)^{2}+\left[\left(m^{2}-1\right)+\left(m^{2}+m+1\right)\right]\left[\left(m^{2}-1\right)-\left(m^{2}+m+1\right)\right]}{2(2 m+1)\left(m^{2}-1\right)} \\
=\frac{(2 m+1)^{2}+\left(2 m^{2}+m\right)(-m-2)}{2(2 m+1)\left(m^{2}-1\right)}=\frac{(2 m+1)\left(1-m^{2}\right)}{2(2 m+1)\left(m^{2}-1\right)}=-\frac{1}{2}, \therefore \alpha=\frac{2 \pi}{3} .
\end{array}
$$