Added @agent as local variable