taskmanager/agent.go
func (s *Agent) Run(process func(*Agent) error) {
	s.task.Update(func(t *Task) interface{} {
		t.taskManager = s.taskManager
		t.Status = AgentTaskStatusRunning
		return t
	})
	s.statusEmitter <- AgentTaskStatusRunning
	go s.startTaskPoller()
	go s.listenForPoll()

	go func(agent Agent) {
		s := &agent
		s.processExitHanderlDecorate(process)
		<-s.processComplete
	}(*s)
}
func (s *Agent) Run(process func(*Agent) error) {
	s.task.Update(func(t *Task) interface{} {
		t.taskManager = s.taskManager
		t.Status = AgentTaskStatusRunning
		return t
	})
	s.statusEmitter <- AgentTaskStatusRunning
	go s.startTaskPoller()
	go s.listenForPoll()

	go func(agent Agent) {
		s := &agent
		s.processExitHanderlDecorate(process)
		<-s.processComplete
	}(*s)
}
//Run - this begins the running of an agent's async process