class Net::SSH::Authentication::KeyManager

def agent

or if the agent is otherwise not available.
agent process. Returns nil if use of an SSH agent has been disabled,
Returns an Agent instance to use for communicating with an SSH
def agent
  return unless use_agent?
  @agent ||= Agent.connect(logger, options[:agent_socket_factory], options[:identity_agent])
rescue AgentNotAvailable
  @use_agent = false
  nil
end