The following snippet adds all opened org-mode files to the org-agenda-files list. However, consider, that org-agenda already provides a means of for example only looking in the buffer from which it was invoked (C-c a < m my-tag RET
) and you might not need to add all the opened files to the org-agenda-files.
(add-hook 'org-mode-hook (function (lambda () (org-agenda-file-to-front))))