Finding the nearest agents to a customer using IComparable
var agents = db.GetAgents();
if(agents == null || agents.Count == 0)
{
    Console.WriteLine("No Results");
}



You should exit your application/code block when you detect an invalid state. Here even if "No Results" is printed, the app will still run into a NullReferenceException or IndexOutOfRangeException in the next few steps.  Also, talking of IndexOutOfRangeException, there is no check against if there is at least 5 agents in your db.

Instead of creating an IComparable, you can just use linq to sort directly. But, since in your case, you also need to print out the distance (the value used for sorting), we will need to create an anonymous class to hold it:

var agents = db.GetAgents();
if(agents == null || agents.Count == 0)
{
    Console.WriteLine("No Results");
    return;
}

var nearestAgents = agents
    .Select(x =&gt; new 
    {
        x.AgentId, 
        DistanceToCustomer = ws.GetDistanceMeters(x.Latitude, x.Longitude, customerLatitude, customerLongitude) 
    })
    .OrderBy(x =&gt; x.DistanceToCustomer);
foreach (var agent in nearestAgents.Take(5))
{
    Console.WriteLine($"agent_id:  {agent.AgentId}  distance: {agent.DistanceToCustomer} m");
}


The .Take(5) ensures that only 5 agent will be printed out, or less.