4. Given $x, y \geqslant 0$, and $x+y \leqslant 2 \pi$. Then the function
$$
f(x, y)=\sin x+\sin y-\sin (x+y)
$$

has a maximum value of
4. $\frac{3 \sqrt{3}}{2}$.

Notice,
$$
\begin{array}{l}
f(x, y)=\sin x+\sin y-\sin (x+y) \\
=2 \sin \frac{x+y}{2}\left(\cos \frac{x-y}{2}-\cos \frac{x+y}{2}\right) \\
\leqslant 2 \sin \frac{x+y}{2}\left(1-\cos \frac{x+y}{2}\right) \\
=8 \sin ^{3} \frac{x+y}{4} \cdot \cos \frac{x+y}{4} \\
=\frac{8}{\sqrt{3}} \sqrt{\sin ^{2} \frac{x+y}{4} \cdot \sin ^{2} \frac{x+y}{4} \cdot \sin ^{2} \frac{x+y}{4} \cdot 3 \cos ^{2} \frac{x+y}{4}} \\
\leqslant \frac{8}{\sqrt{3}} \sqrt{\left.\frac{\sin ^{2} \frac{x+y}{4}+\sin ^{2} \frac{x+y}{4}+\sin ^{2} \frac{x+y}{4}+3 \cos ^{2} \frac{x+y}{4}}{4}\right)^{4}} \\
=\frac{3 \sqrt{3}}{2} .
\end{array}
$$

When $\tan \frac{x+y}{4}=\sqrt{3}, \cos \frac{x-y}{2}=1$, the above inequality holds with equality.
Therefore, the maximum value is $\frac{3 \sqrt{3}}{2}$.