Skip to content

tdfs4ds.agentops.names

tdfs4ds.agentops.names

Who holds an agent name in AgentOps, and how to free it for a new deployment.

A definition name is unique in the workspace, and DELETE /agent_definitions/{id} only archives the definition: it keeps the name, so a second POST /agent_definitions with the same name is 409 CONFLICT_ERROR (seen on AI Studio pp54). The API has no hard delete, but PATCH /agent_definitions/{id} accepts a new name on an archived definition. Renaming it to <name>-archived-<id8> frees the name and keeps the history; that is the mechanism used here.

Safety rules, each tested:

  • a name held by a live deployment, or by a deployment another user created, is never touched (blocked, with who and what to do);
  • a definition is freed only when it is archived or failed. A published or still-creating definition with no deployment has no owner on record (created_by is system for every definition), so it is refused rather than guessed;
  • every lookup failure is fail-open: the state is unknown, nothing is changed, and the register step reports the platform's own answer.

logger module-attribute

logger = logging.getLogger('tdfs4ds.agentops')

_ARCHIVED_TAG module-attribute

_ARCHIVED_TAG = '-archived-'

_MAX_NAME module-attribute

_MAX_NAME = 255

_is_gone

_is_gone(dep)

archived_name

archived_name(name, definition_id)

The name an archived definition is renamed to (pure, within 255 chars).

inspect_name

inspect_name(client, name, caller=None)

Who holds name. Returns {"state", "definitions", "reason", "hint"}.

free: nobody. reusable: only archived/failed definitions of this caller, without live deployment; :func:free_name can release them. blocked: a live deployment, another user, or an unarchived definition. unknown: the registry could not be read (fail-open).

_dep_name

_dep_name(dep)

free_name

free_name(client, name, caller=None, definitions=None)

Rename the archived/failed definitions holding name; archive a failed one first.

Returns the list of (definition_id, new_name) renamed. Raises nothing for an API refusal: a refused rename is left out of the list and logged.

release_definition

release_definition(client, definition_id)

Rename one archived definition so its name can be reused.

Returns (name_before, new_name); new_name is None when it was already renamed. Raises on an API error (the caller decides how to report it).

name_is_free

name_is_free(client, name)

True/False whether no definition (archived included) holds name; None if unreadable.