def get_agent_path(agent_dir_path, agent_dir_suffix):
    """
    Stand-alone method based off of agent_name method from AIPplatform.
    Gets the path to the agent file of the specified directory if it exists.
    """
    for agent_name in agent_dir_path.iterdir():
        try:
            for agent_subdir in agent_name.iterdir():
                agent_dir = agent_name.joinpath(
                    agent_subdir.stem + f".{agent_dir_suffix}")
                if agent_dir.exists():
                    return agent_dir
        # Ignore files that are not directories
        except NotADirectoryError:
            pass

    raise KeyError(agent_dir_path.stem)