Automation triggers based on who triggered the switch


As we can all know, in the history of “more info” for every switch, we can see who changed the state of that swtich. If the switch was toggled by an automation, it will show in this history info.
Now, my question is, how can I make an automation to trigger something based on this information?
Let’s say that I have two automations (a and b) which changes the state of the switch. I want to make an automation which triggers regarding a condition… If switch state was changed by automation “a” do something, if by autiomation “b” do something else.
Is this possible?

Thank you in advance!