If the state doesn't have that policy, then its clear the "agent" wasn't acting on behalf of the state.
Wrong - the agent IS acting on behalf of the state - by definition - in the performance (or non-performance) of his state-sanctioned duties.
He SHOULD be forced to do the job he was elected to do. If he cannot - because of his own personal beliefs - then he should never have run for the position that requires him to do so.
What if a policeman let's his partner get shot and killed because he is morally opposed to shooting his own weapon?
Shouldn't be in the job in the first place.
If Archie Bunker here can't perform his state duties in accordance with state law - he shouldn't be in the job in the first place.
It does depend on his actual job description, if he is required to marry anyone that asks. Usually JPs do not have to marry anyone, like in New England area where gay marriage is legal, but justices are allowed to refuse to marry gays.
If he is required to, then I would agree with you that he shouldn't be in the job and should quit or be fired.
As I stated before, no one is forced to do their job if they don't want to. Refusing to do ones job isn't illegal unless it can cause harm like the your cop example. As far as I know refusing to marry a couple isn't the same as allowing someone to die.