Example 8 Let $x \in\left(-\frac{1}{2}, 0\right)$. Then
$$
\begin{array}{l}
a_{1}=\cos (\sin x \pi), a_{2}=\sin (\cos x \pi), \\
a_{3}=\cos (x+1) \pi
\end{array}
$$

the size relationship is ( ).
(A) $a_{3}<a_{2}<a_{1}$
(B) $a_{1}<a_{3}<a_{2}$
(C) $a_{3}<a_{1}<a_{2}$
(D) $a_{2}<a_{3}<a_{1}$
(1996, National High School Mathematics Competition)
Analysis: By the uniqueness of the answer, the size relationship must satisfy the special value $x_{0}=-\frac{1}{4} \in\left(-\frac{1}{2}, 0\right)$. At this time,
$$
\begin{aligned}
a_{1} & =\cos \left[\sin \left(-\frac{\pi}{4}\right)\right]=\cos \left(-\frac{\sqrt{2}}{2}\right) \\
& =\cos \frac{\sqrt{2}}{2}, \\
a_{2} & =\sin \left[\cos \left(-\frac{\pi}{4}\right)\right]=\sin \frac{\sqrt{2}}{2}, \\
a_{3} & =\cos \left(\frac{3}{4} \pi\right)=-\frac{\sqrt{2}}{2}\sin \frac{\sqrt{2}}{2}.
\end{aligned}
$$
Then $a_{1}>a_{2}>a_{3}$. Therefore, the answer is (A).