Skip to content

API Reference parrot.utils.naming

github-actions[bot] edited this page Dec 2, 2026 · 4 revisions

parrot.utils.naming

View source

Name normalization utilities for bot/agent creation.

Provides slug generation and de-duplication for agent names used in URLs and database identifiers.

Function deduplicate_name

Find a unique name by appending a numeric suffix if needed.

Calls exists_fn to check whether a candidate name is already taken. If the base slug is free, it is returned as-is. Otherwise suffixes -2 through -99 are tried.

deduplicate_name(slug: str, exists_fn: Callable[[str], Awaitable[Optional[str]]]) -> str

Parameter Type Default Description
slug str The base slug to check (output of :func:slugify_name).
exists_fn Callable[[str], Awaitable[Optional[str]]] An async callable that receives a candidate name and returns a non-None value (e.g. "database") when the name is taken, or None when it is available.

Returns: str — The first available candidate name.

Raises:

  • ValueError — If all suffixes up to -99 are exhausted.

Function slugify_name

Convert a user-provided name into a URL-safe slug.

Strips whitespace, lowercases, replaces non-alphanumeric characters with hyphens, collapses consecutive hyphens, and strips leading/trailing hyphens.

slugify_name(name: str) -> str

Parameter Type Default Description
name str The raw name string from user input.

Returns: str — A lowercase, hyphen-separated slug (e.g. "my-cool-bot").

Raises:

  • ValueError — If the result is empty after normalization.

Architecture

Clients

Bots & Agents

Memory

Knowledge

Tools & Toolkits

Flows

Experts

Skills

Stores & Loaders

MCP & A2A

Server & APIs

Integrations

Outputs & A2UI

Prompts

Security

Operations

Migration

SDD Tooling

LLM Wiki

Deployment

Decisions

API Reference

Clone this wiki locally