Skip to content

make_id

autogen.beta.network.ids.make_id #

make_id()

Return a fresh UUID-based identifier as a 32-char hex string.

Prefers UUID7 (time-ordered, cross-process sortable) when available; falls back to UUID4 on older Pythons. The in-process hub stamps every envelope under a per-session lock so process-local ordering is already serialised; the time-ordered prefix matters once the transport spans processes.

Source code in autogen/beta/network/ids.py
def make_id() -> str:
    """Return a fresh UUID-based identifier as a 32-char hex string.

    Prefers UUID7 (time-ordered, cross-process sortable) when available;
    falls back to UUID4 on older Pythons. The in-process hub stamps every
    envelope under a per-session lock so process-local ordering is
    already serialised; the time-ordered prefix matters once the
    transport spans processes.
    """
    if hasattr(uuid, "uuid7"):
        return uuid.uuid7().hex  # type: ignore[attr-defined]
    return uuid.uuid4().hex