It looks like you are optimizing over the surface of a ball. That constraint is non-convex, but I think with your objective the solution will always be on the surface, so you can relax it to be $ \leq 1 $ and now its convex - thats a good start. So lets make that change.
Now if you ignore the absolute sign, you are maximizing a linear objective over a ball. Thats easy. So solve two optimization problems
$\begin{align}
& \text{max}_{x_i} \quad \sum_{i=1}^{4} a_i x_i \\
& s.t. \quad \sum_{i=1}^4 x_i^2 \leq 1
\end{align}
$
and
$\begin{align}
& \text{max}_{x_i} \quad -\sum_{i=1}^{4} a_i x_i \\
& s.t. \quad \sum_{i=1}^4 x_i^2 \leq 1
\end{align}
$
and take the best of the two. Both these problems have a closed form solution - you can use the Karush-Kuhn-Tucker conditions to find it, or just throw it into a solver like Gurobi/CPLEX/Mosek/IPOPT/whatever you have a available that can handle quadratic constraints.