Let $f(x) = x^{2} + ax + b$. If for all nonzero real $x$:
\[ f\left(x + \frac{1}{x}\right) = f\left(x\right) + f\left(\frac{1}{x}\right) \]
and the roots of $f(x) = 0$ are integers, what is the value of $a^{2} + b^{2}$?

Let's think step by step and output the final answer within \boxed{}.
user