3. Given $\left\{a_{n}\right\}$ is a geometric sequence, and $a_{1} a_{2017}=1$. If $f(x)=\frac{2}{1+x^{2}}$, then $\sum_{i=1}^{2017} f\left(a_{i}\right)=$ $\qquad$
3. 2017.

Given $f(x)=\frac{2}{1+x^{2}}$, we know that
$$
f(x)+f\left(x^{-1}\right)=\frac{2}{1+x^{2}}+\frac{2}{1+x^{-2}}=2 \text{.}
$$

Also, $\left\{a_{n}\right\}$ is a geometric sequence, and $a_{1} a_{2017}=1$, then
$$
\begin{array}{l}
a_{i} a_{2018-i}=1(i=1,2, \cdots, 2017). \\
\text{Therefore, } \sum_{i=1}^{2017} f\left(a_{i}\right)=\frac{1}{2} \sum_{i=1}^{2017}\left(f\left(a_{i}\right)+f\left(a_{i}^{-1}\right)\right) \\
=2017.
\end{array}
$$