2. Given the function
$$
f(x)=\sin x+\sqrt{1+\cos ^{2} x}(x \in \mathbf{R}) \text {. }
$$

Then the range of the function $f(x)$ is $\qquad$
2. $[0,2]$.

From the given information, we have
$$
f(x) \leqslant \sqrt{2\left(\sin ^{2} x+1+\cos ^{2} x\right)}=2,
$$

and $|\sin x| \leqslant 1 \leqslant \sqrt{1+\cos ^{2} x}$.
Therefore, $0 \leqslant \sin x+\sqrt{1+\cos ^{2} x} \leqslant 2$.
Hence, when $\sqrt{1+\cos ^{2} x}=\sin x$, that is,
$$
x=2 k \pi+\frac{\pi}{2}(k \in \mathbf{Z})
$$

$y_{\text {max }}=2$;
when $\sqrt{1+\cos ^{2} x}=-\sin x$, that is,
$$
x=2 k \pi-\frac{\pi}{2}(k \in \mathbf{Z})
$$

$y_{\text {min }}=0$.
In summary, the range of the function $f(x)$ is $[0,2]$.