import requests


def get_agents(url, agents_tag, headers):
    """Get the agents."""
    req = requests.get(url + "/agents/", headers=headers)
    if req.status_code != 200:
        raise ValueError("Unable to get the token")

    return [a for a in req.json()["results"] if agents_tag in a["parameters"]["tags"]]