agent query definition