The earlier you pick up on behaviour that shows signs of agitation the better. The time between the emergence of such behaviour and its escalation to more serious acting out forms of misbehaviour can be very brief. Depending on the student, your relationship with the student and the student’s history, you can:
Move in and acknowledge the students behaviour or signs of agitation and offer assistance.
Give the student some space, for example, to work on their own as opposed to work in a group, maybe to run an errand for you.
Give the student more time to finish the task.
Allow the student to do another activity, preferably a preferred activity, and ideally to complete the original task at another time.
Move closer to the student. Keep in mind that this may be interpreted as supportive by some students and provocative by others.
Give the student a choice of activities or the choice of working with someone he or she gets along with.
Talk to the student privately offering advice or suggesting he or she go through their relaxation procedure.
Reference links.