This is actually really straight forward, just use the SSH_AUTH_SOCK
environment variable:
const socket = process.env.SSH_AUTH_SOCK
const ssh = new (require('node-ssh'))
ssh.connect({
username: 'username',
host: 'example.com',
agent: socket
}).then(() => {
// success
}, console.error)