Today I learned about keychain and how to use it to manage ssh and gpg agents.

Keychain create one ssh-agent per system, unlike ssh-agent that creates one agent per login session (if placed in zprofile) and require multiple ssh-add for keys.
In addition to that ssh-agent is not compatible with cron jobs or shell scripts because they do not inherit the SSH_AUTH_SOCK variable from the environnement.

# run a ssh agent and add the id_rsa key (using keychain)
eval `keychain --eval --agents ssh id_rsa`
OptionUse
–agentsspecify agents to run (gpg or ssh)
–clearclear the cached keys for every new login
-k [all|mine]kill all the agents, or only agents started by keychain
–dirspecify the dir where the SSH_AUTH_SOCK will be cached