4. As shown in the upper right figure, the radii of semicircles $A$ and $B$ are equal, they are tangent to each other, and both are internally tangent to the semicircle $O$ with radius 1. $\odot O_{1}$ is tangent to both of them, and $\odot O_{2}$ is tangent to $\odot O_{1}$, semicircle $O$, and semicircle $B$. Then the radius $r$ of $\odot O_{2}$ is $\qquad$
4. $\frac{1}{6}$.

Connect $\mathrm{AO} \mathrm{O}_{1}, \mathrm{O}_{1} \mathrm{O}, \mathrm{OO}_{2}, \mathrm{O}_{1} \mathrm{O}_{2}, \mathrm{O}_{2} \mathrm{~B}$. Let the radius of $\odot \mathrm{O}_{1}$ be $r_{1}$, then $A O^{2}+O O_{1}^{2}=A O_{1}^{2}$, i.e.,
$$
\begin{array}{l}
\left(\frac{1}{2}\right)^{2}+\left(1-r_{1}\right)^{2} \\
=\left(\frac{1}{2}+r_{1}\right)^{2}, \\
\therefore r_{1}=\frac{1}{3} . \\
\quad \text { Also } O O_{1}=\frac{2}{3}, O_{1} O_{2}=\frac{1}{3}+r, O O_{2}=1-r,
\end{array}
$$
$O_{2} B=\frac{1}{2}+r$, then
$$
\begin{array}{l}
\cos \angle O_{1} O O_{2} \\
=\frac{\left(\frac{2}{3}\right)^{2}+(1-r)^{1}-\left(\frac{1}{3}+r\right)^{2}}{2 \cdot \frac{2}{3} \cdot(1-r)}, \\
\cos \angle O_{2} O B \\
=\frac{(1-r)^{2}+\left(\frac{1}{2}\right)^{2}-\left(\frac{1}{2}+r\right)^{2}}{2 \cdot \frac{1}{2}(1-r)} .
\end{array}
$$

Using $\cos ^{2} \angle O_{1} O O_{2}+\cos ^{2} \angle O_{2} O B$
$$
=\sin ^{2} \angle O_{2} O B+\cos ^{2} \angle O_{2} O B=1 \text {, }
$$

we solve to get $r=\frac{1}{6}$.