Skip to content

main

arai_ai_agents.main

list_available_agents()

List all available agent configs in the configs folder

Returns:

Name Type Description
list

List of available agent names

Source code in arai_ai_agents/main.py
def list_available_agents():
    """List all available agent configs in the configs folder

    Returns:
        list: List of available agent names
    """
    agents = []
    configs_dir = "configs"
    if os.path.exists(configs_dir):
        for item in os.listdir(configs_dir):
            if os.path.isdir(os.path.join(configs_dir, item)):
                agents.append(item)
    return agents

list_available_seasons(agent_name)

List all available seasons for an agent

Parameters:

Name Type Description Default
agent_name str

The name of the agent to list seasons for

required

Returns:

Name Type Description
list

List of available season names

Source code in arai_ai_agents/main.py
def list_available_seasons(agent_name):
    """List all available seasons for an agent

    Args:
        agent_name (str): The name of the agent to list seasons for

    Returns:
        list: List of available season names
    """
    seasons = []
    config_path = os.path.join("configs", agent_name)
    if os.path.exists(config_path):
        for item in os.listdir(config_path):
            if os.path.isdir(os.path.join(config_path, item)):
                seasons.append(item)
    return seasons

load_agent_config(agent_name)

Load configuration for the selected agent

Parameters:

Name Type Description Default
agent_name str

The name of the agent to load configuration for

required

Returns:

Name Type Description
dict

The configuration for the selected agent

Source code in arai_ai_agents/main.py
def load_agent_config(agent_name):
    """Load configuration for the selected agent

    Args:
        agent_name (str): The name of the agent to load configuration for

    Returns:
        dict: The configuration for the selected agent
    """
    config_path = os.path.join("configs", agent_name, "tracker.yaml")
    with open(config_path, 'r', encoding='utf-8') as f:
        return yaml.safe_load(f)

run_scheduler()

Continuously run the scheduler in a loop

Global

scheduler_running (bool): Whether the scheduler is running

Source code in arai_ai_agents/main.py
def run_scheduler():
    """ Continuously run the scheduler in a loop 

    Global:
        scheduler_running (bool): Whether the scheduler is running
    """
    global scheduler_running
    scheduler_running = True
    while scheduler_running:
        schedule.run_pending()
        time.sleep(1)