8. Let the sequence $\left\{a_{n}\right\}$ have 10 terms, $a_{i} \in\{1,-1\}$ $(i=1,2, \cdots, 10)$, and for any $k \leqslant 9$, we have
$$
\left|\sum_{i=1}^{k} a_{i}\right| \leqslant 2, \sum_{i=1}^{10} a_{i}=0 .
$$

Then the number of sequences $\left\{a_{n}\right\}$ that satisfy the conditions is
8. 162 .

Line Method: The number of sequences satisfying $\sum_{i=1}^{10} a_{i}=0$ is $\mathrm{C}_{10}^{5}$. If there exists a $k$ such that $\sum_{i=1}^{k} a_{i}>2$, then the number of such sequences is $\mathrm{C}_{10}^{2}$.

Similarly, if there exists a $k$ such that $\sum_{i=1}^{k} a_{i}2$, then at least 6 steps are required, and $\sum_{i=1}^{k} a_{i}2$ and the existence of an $l$ such that $\sum_{i=1}^{l} a_{i}>2$ must occur simultaneously.

Thus, the total number of sequences satisfying the conditions is $\mathrm{C}_{10}^{5}-2 \mathrm{C}_{10}^{2}=162$.