Prompt Version Tagging#
Prompt version tags are named, human-readable labels (e.g., production, staging, development) that can be assigned to specific prompt versions in Phoenix. They provide a lightweight aliasing system so callers can resolve a prompt by a stable tag name rather than a version ID.
Default Tags#
Three built-in tags are pre-seeded from DEFAULT_PROMPT_VERSION_TAGS in app/src/constants/promptConstants.ts:
| Tag | Description |
|---|---|
production | The version deployed to production |
staging | The version deployed to staging |
development | The version deployed for development |
These defaults are merged with any custom tags the user has created when rendering the tag selection popover .
Tag Name Constraints#
Tag names must satisfy the identifierPattern validator from app/src/utils/identifierUtils.ts: lowercase alphanumeric, allowing internal underscores and dashes, but starting and ending with alphanumeric characters (/^[a-z0-9]([_a-z0-9-]*[a-z0-9])?$/).
Key UI Components#
TagPromptVersionButton#
TagPromptVersionButton.tsx is the primary entry point for tagging a version. It renders a "Tag Version" button on the prompt version page (requires promptId and versionId from route params). Clicking it opens a Popover with a TagList sub-component showing all available tags as checkboxes — pre-checked if the tag is already applied to the current version .
- Tags already applied are shown as checked and disabled (no un-tagging via this UI; a tag can only be moved, not removed).
- The "New Tag" button inside the popover dismisses it and opens the
NewPromptVersionDialog.
Data is loaded via a lazy Relay query TagPromptVersionButtonTagsQuery that fetches both all versionTags on the prompt and the tags already applied to the specific version.
NewPromptVersionTagDialog#
NewPromptVersionTagDialog.tsx is a modal form (react-hook-form + Relay mutation) for creating a new tag and immediately assigning it to the current prompt version. Fields:
- Tag Name — required, validated against
identifierPattern - Description — optional free text
On submit it fires the setPromptVersionTag GraphQL mutation and re-fetches the PromptVersionTagsList_data fragment to refresh the version's tag list.
PromptVersionTagsConfigCard#
PromptVersionTagsConfigCard.tsx renders a compact sortable table of all tags defined on a prompt (not per-version). Columns: Name, Description, and a linked Version ID that navigates to /prompts/:promptId/versions/:versionId. Each row has an inline DeletePromptVersionTagButton that fires the deletePromptVersionTag mutation.
Data comes from the PromptVersionTagsConfigCard_data Relay fragment on the Prompt type , querying versionTags { id, name, description, promptVersionId }.
GraphQL API Surface#
| Operation | Mutation / Fragment | Purpose |
|---|---|---|
| Create / move tag | setPromptVersionTag(input: SetPromptVersionTagInput!) | Assigns a tag name to a prompt version; creates if new, moves if existing |
| Delete tag | deletePromptVersionTag(input: ...) | Removes a tag entirely from the prompt |
| Read tags on prompt | PromptVersionTagsConfigCard_data fragment | Prompt.versionTags[] — all tags across all versions |
| Read tags on version | TagPromptVersionButtonTagsQuery | PromptVersion.tags[] — tags set on a specific version |
File Map#
| File | Role |
|---|---|
TagPromptVersionButton.tsx | Button + popover for applying existing or new tags to a version |
NewPromptVersionTagDialog.tsx | Modal form for creating a new tag |
PromptVersionTagsConfigCard.tsx | Config card listing all tags on a prompt with delete actions |
DeletePromptVersionTagButton.tsx | Inline delete button inside the config card |
app/src/constants/promptConstants.ts | DEFAULT_PROMPT_VERSION_TAGS definition |
app/src/utils/identifierUtils.ts | identifierPattern regex for tag name validation |