Example 5 Let the quadratic function $y=x^{2}+2 a x+\frac{a^{2}}{2}(a<0)$ have its vertex at $A$, and intersect the $x$-axis at points $B$ and $C$. When $\triangle A B C$ is an equilateral triangle, the value of $a$ is $\qquad$
Explanation: The graph of the quadratic function
$$
y=x^{2}+2 a x+\frac{a^{2}}{2}(a<0)
$$
is shown in Figure 4. Let \( A\left(-a,-\frac{a^{2}}{2}\right) \),
$$
B\left(x_{1}, 0\right), C\left(x_{2}, 0\right) \text {. }
$$

Let the intersection of the axis of symmetry with the \( x \)-axis be \( D \). Then
$$
\begin{array}{l}
|B C|=\left|x_{1}-x_{2}\right| \\
=\sqrt{\left(x_{1}+x_{2}\right)^{2}-4 x_{1} x_{2}} \\
=\sqrt{4 a^{2}-4 \times \frac{a^{2}}{2}}=\sqrt{2 a^{2}}=-\sqrt{2} a . \\
\text { Also, }|A D|=\frac{\sqrt{3}}{2}|B C| \text {, so } \\
\left|-\frac{a^{2}}{2}\right|=\frac{\sqrt{3}}{2}(-\sqrt{2} a) .
\end{array}
$$

Solving this, we get \( a=-\sqrt{6} \) or \( a=0 \) (which is discarded).
Therefore, \( a=-\sqrt{6} \).