An agent is basically a program that holds your SSH keys in memory, so you only have to unlock them once instead of every single time. The ssh-agent command does exactly this for SSH keys.
Here are the usual ways to start it:
eval ssh-agent – this runs the agent in the background and sets the necessary environment variables for your current shell session.
(When started with no arguments, ssh-agent outputs commands that your shell interprets.)
exec ssh-agent bash – this launches a new instance of the bash shell, taking over from the current one.
(With one or more arguments, ssh-agent doesn't output anything, but it starts the specified command—in this case, bash, though technically it could be anything.)
The second method (exec) is sometimes preferred because it automatically kills ssh-agent when you close your terminal window. If you use eval, the agent will stay running, just inaccessible to your current session.
However, starting the agent alone doesn't make it useful—you still need to load your keys using ssh-add. This command unlocks your keys (usually files like ~/.ssh/id_*) and loads them into the agent, making them accessible for SSH or SFTP connections.