I think the creation of the agent just needs to be updated with a check for local so that it can use a local agent.