You need to assess only two things to answer this questions. The tasks Size, and the level of Autonomy.
For the size of the problem, all you need to know is whether it can be done fully by one person or whether it will require a collective effort of many. This mainly translates to assessing the skill-set required to accomplish the task, and whether those skills could exist in one person or not.
Level of Autonomy
As for the autonomy level, you need to pick some criteria to assess this. I choose S.M.A.R.T, so the more SMART the task is the higher it’s autonomy. You can select your own criteria, but the main question that it should allow you to answer is: how much of decision power over details can be delegated to the assigned person or team in order to achieve the task.
The following chart shows the spot where freelancers can be considered for the job.
It reads as following:
[bottom-left quarter] If the task has very low autonomy level (you cannot delegate any decision power over details) and is very small (can be done by one person), then you are better off doing it yourself.
[bottom-right quarter] If the task has low level of autonomy but is quite big (needs several people to achieve it), then you will necessarily need a coherent in-house team to do it well.
[top-right quarter] If the task has high level of autonomy (you can almost leave all decisions on details to the assigned person/team) and it is big, then you may consider going to an agency. This could still be done by your internal team, if you have one and they have no more challenging tasks to take care of.
[top-left quarter] Finally, the sweet spot for freelancers is those tasks that have high level of autonomy and are small enough to be achievable by one person.