I need to run a function every time I run
org-agenda. However, I need it to run prior to the agenda. I wasn't able to find any hooks for the agenda command in the documentation. Any guidance is appreciated.
org-agenda-mode-hook is run from
org-agenda-mode which in turn is run from
org-agenda-prepare which is run by
org-agenda-list before the agenda is created (and while the buffer is still writable). If that's early enough, you can add your function to the hook with
(add-hook 'org-agenda-mode-hook 'my-function)
If that's not early enough, then @lawlist's suggestions for a wrapper function or a before advice would be the only solutions I can see.