from typing import Union
from typing import List
from typing import Set


def decide_conn_number(agents: Union[List, Set], max_lim: int, also_me: bool = True) -> int:
    """
    Given a set of agents decides the number of connections to be created between them based on a maximum number.
    :param agents: Union[List, Set], agents
    :param max_lim: int, an arbitrary maximum number
    :param also_me: bool, include caller
    :return: max_lim if the agents are more than max_lim otherwise returns the number of agents minus one.
    """
    if len(agents) <= max_lim:
        return len(agents) - 1 if also_me else len(agents)
    else:
        return max_lim