An agonist is a chemical or a substance which initiates a psychological response when it binds with the receptor. It combines with a cell receptor to produce certain reaction which is typical for that substance.
An antagonist is any substance that interferes with response.
Agonist and antagonist functions opposite to each other. An agonist is used to produce an action whereas an antagonist is used to oppose any action.
In the context, the use of Ecstasy increases serotonin in the synapse whereas the use of Trazodone opposes the effect of serotonin. Here Ecstasy works as a serotonin agonist while Trazodone is a serotonin anagonist.