updated JS to include agent methods