5. Let $z$ be a complex number with modulus 1. Then the maximum value of $\left|\frac{z+\mathrm{i}}{z+2}\right|$ is $\qquad$ .


5. $\frac{2 \sqrt{5}}{3}$.

Let $z=\cos \theta+\mathrm{i} \sin \theta$.
$$
\begin{array}{l}
\text { Then } p=\left|\frac{z+\mathrm{i}}{z+2}\right|^{2}=\left|\frac{\cos \theta+(\sin \theta+1) \mathrm{i}}{(\cos \theta+2)+\mathrm{i} \sin \theta}\right|^{2} \\
=\frac{2+2 \sin \theta}{5+4 \cos \theta} \\
\Rightarrow 5 p-2=2 \sin \theta-4 p \cos \theta \\
\quad=\sqrt{16 p^{2}+4} \sin (\theta+\varphi),
\end{array}
$$

where, $\varphi=\arctan (-2 p)$.
Thus, $(5 p-2)^{2} \leqslant 16 p^{2}+4$
$$
\Rightarrow 9 p^{2}-20 p \leqslant 0 \Rightarrow p_{\max }=\frac{20}{9} \text {. }
$$

Therefore, $\left|\frac{z+\mathrm{i}}{z+2}\right|_{\text {max }}=(\sqrt{p})_{\text {max }}=\frac{2 \sqrt{5}}{3}$ (at this point, there exists $\theta=\frac{\pi}{2}-\varphi$, which can correspond to the value of $z$ ).