4. Two vectors $\overrightarrow{O A}$ and $\overrightarrow{O B}$ on a plane satisfy $|\overrightarrow{O A}|=a,|\overrightarrow{O B}|=b$, and $a^{2}+b^{2}=4, \overrightarrow{O A} \cdot \overrightarrow{O B}=0$. If the vector $\overrightarrow{O C}=\lambda \overrightarrow{O A}+\mu \overrightarrow{O B}(\lambda, \mu \in \mathbf{R})$, and
$$
\left(\lambda-\frac{1}{2}\right)^{2} a^{2}+\left(\mu-\frac{1}{2}\right)^{2} b^{2}=1,
$$

then the maximum value of $|\overrightarrow{O C}|$ is . $\qquad$
4. 2 .

Since $|\overrightarrow{O A}|=a,|\overrightarrow{O B}|=b$, and $a^{2}+b^{2}=4, O A \perp O B$, therefore, points $O, A, B$ lie on a circle with the midpoint $M$ of $A B$ as the center and 1 as the radius.
Also, $\overrightarrow{O M}=\frac{1}{2}(\overrightarrow{O A}+\overrightarrow{O B}), \overrightarrow{O C}=\lambda \overrightarrow{O A}+\mu \overrightarrow{O B}$, then
$$
\overrightarrow{M C}=\overrightarrow{O C}-\overrightarrow{O M}=\left(\lambda-\frac{1}{2}\right) \overrightarrow{O A}+\left(\mu-\frac{1}{2}\right) \overrightarrow{O B}
$$

Thus,
$$
\begin{aligned}
|\overrightarrow{M C}|^{2} & =\left(\lambda-\frac{1}{2}\right)^{2} \overrightarrow{O A}^{2}+2\left(\lambda-\frac{1}{2}\right)\left(\mu-\frac{1}{2}\right) \cdot \overrightarrow{O A} \cdot \overrightarrow{O B}+\left(\mu-\frac{1}{2}\right)^{2} \overrightarrow{O B}^{2} \\
& =\left(\lambda-\frac{1}{2}\right)^{2} a^{2}+\left(\mu-\frac{1}{2}\right)^{2} b^{2}=1
\end{aligned}
$$

Therefore, point $C$ also lies on the circle with $M$ as the center and 1 as the radius. Hence, points $O, A, B, C$ are concyclic, with $M$ as the center. When $O, M, C$ are collinear, i.e., $O C$ is a diameter of $\odot M$, $|O C|$ reaches its maximum value of 2.