When do you use agents and tasks, and when do you use a GenServer?
The answer is to use the simplest approach that works. Agents and tasks are great when you are dealing with very-specific background activities, whereas GenServers (as their name suggests) are more general.
You can eliminate the need to make a decision by wrapping your agents and tasks in modules, as we did in our anagram example. That way you can always switch from the agent or task implementation to the full-blown GenServer without affecting the rest of the code base.
It’s time to move on, and look at some advanced Elixir.