INNER CODE UNIT · Python

save_agent_id

ChrispyBacon-dev/DockFlare · dockflare-agent/app/main.py:353

def save_agent_id(agent_id):
    """Saves agent ID to the filesystem."""
    try:
        _write_secure_file(AGENT_ID_FILE, lambda fh: fh.write(agent_id))
        logging.info(f"Saved Agent ID to {AGENT_ID_FILE}")
    except IOError as e:
        logging.error(f"Could not save agent ID file: {e}")

def register_with_master():
    """
    Registers the agent with the DockFlare Master instance and retrieves an agent ID.
    """
    global AGENT_ID, last_successful_master_contact
    if not MASTER_URL or not API_KEY:
        logging.error("Error: DOCKFLARE_MASTER_URL and DOCKFLARE_API_KEY must be set.")
        return False

    endpoint = f"{MASTER_URL}/api/v2/agents/register"

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…