fix(agent): Lock AgentState in event handlers

Access to the AgentState object by the Agent event
handlers must be done in a transaction. Locking from
the event handlers themselves gets us this. This cuts
down on mis-scheduling of jobs since Agents are no
longer dealing with a racy view of their state when
bidding on Jobs.