CertSafari
    Databricks Certified Generative AI Engineer Associate· Lessons

    Domain 4 · Lesson 39/56

    Promoting Prompts Across Environments with MLflow Prompt Registry Aliases

    Apply CI/CD best practices such as updating a Vector Search index, promoting prompts across environments, and testing individual components of an agent.

    9 min read
    1.79% of exam
    3 sources
    Published 3 Oct 2026
    Docs as of 30 Sep 2026

    What you will be able to do

    • Explain how prompts, versions, aliases and tags relate in the MLflow Prompt Registry
    • Load a prompt in deployed agent code by alias instead of a hard-coded version
    • Promote a prompt from dev to staging to production, and roll it back, by reassigning aliases

    Key concept

    Prompt alias — An alias is a named, movable pointer (such as dev, staging or production) to one prompt version, and the version it points to never changes. To promote or roll back a prompt you move the pointer. You don't redeploy the agent.

    1.Prompts as versioned Unity Catalog assets

    In a CI/CD pipeline every artifact you promote needs a version and an owner. For agent prompts, Databricks provides the MLflow Prompt Registry (currently in Beta). It is a central store for prompt templates that works much like Git: you get versioning, commit messages and the ability to roll back. Governance comes from Unity Catalog, so a prompt is a named object inside a catalog and schema, such as workspace.default.summarization_prompt. To view or create prompts you need a Unity Catalog schema on which you hold CREATE FUNCTION, EXECUTE and MANAGE permissions.

    The registry has four building blocks. A prompt is the named entity in Unity Catalog. A version is a snapshot that can't be changed, and version numbers count up automatically. An alias is a pointer you can move to any version. Tags are key-value pairs attached to a specific version. Each call to register_prompt() on an existing name adds a new version and leaves the earlier ones as they were. Templates use double-brace variables such as {{question}}.

    Checkpoint 1 of 4· Match them up

    Match each Prompt Registry concept to its description

    Tap a term, then the definition that fits it.

    The six Prompt Registry functions and their role in a promotion workflow
    FunctionPurpose
    register_prompt()Create new prompts or add new versions
    load_prompt()Retrieve specific prompt versions or aliases
    search_prompts()Find prompts by name, tags, or metadata
    set_prompt_alias()Create or update alias pointers
    delete_prompt_alias()Remove aliases (versions remain)
    delete_prompt()Delete entire prompts or specific versions

    Sources12

    2.Loading prompts by alias in deployed code

    Databricks tells you to configure a deployed agent so it loads prompts by alias rather than by a hard-coded version, because this lets you change the prompt without redeploying. Your code refers to a prompt with a URI of the form prompts:/{catalog}.{schema}.{prompt_name}@{alias}. For example, prompts:/workspace.default.summarization_prompt@production resolves to whatever version the production alias points to right now.

    The recommended pattern also reads the alias and prompt name from environment variables. The same code can then run in dev, staging and production, and each environment only sets a different PROMPT_ALIAS.

    A deployed app that reads the prompt name and alias from environment variables and loads the prompt by aliaspython
    class ProductionApp:
        def __init__(self):
            # Use environment variable for flexibility
            self.prompt_alias = os.getenv("PROMPT_ALIAS", "production")
            self.prompt_name = os.getenv("PROMPT_URI", "workspace.default.summarization_prompt")
    
        def get_prompt(self) -> str:
            """Load prompt from registry using alias."""
            uri = f"prompts:/{self.prompt_name}@{self.prompt_alias}"
            prompt = mlflow.genai.load_prompt(uri)
            return prompt

    A common worry is that calling the registry adds a network round trip to every request. It does not, because the MLflow client caches the prompt template. There is one deployment exception. If the agent is deployed using Custom Agents, it can reach the registry only through manual authentication, which means overriding security environment variables. Doing so turns off automatic passthrough for the other resources the agent depends on, so plan their credentials explicitly.

    Checkpoint 2 of 4· Check yourself

    A reviewer objects that loading prompts with mlflow.genai.load_prompt() in a production agent will slow every request. What is the correct response?

    Sources2

    3.Promoting and rolling back across environments

    After the agent loads by alias, promotion is a metadata operation. During development you register each new prompt version and point a dev alias at it, so you can test the change before it reaches production. To promote, you read the version that the source environment's alias points to and set the target environment's alias to that same version. The prompt text itself is never copied. Staging and production end up pointing at the identical version that was tested.

    Promoting a prompt by copying one environment's alias to anotherpython
    import mlflow
    
    def promote_prompt(name: str, from_env: str, to_env: str):
        """Promote prompt from one environment to another."""
    
        # Get current version in source environment
        source = mlflow.genai.load_prompt(f"prompts:/{name}@{from_env}")
    
        # Point target environment to same version
        mlflow.genai.set_prompt_alias(
            name=name,
            alias=to_env,
            version=source.version
        )
    
        print(f"Promoted {name} v{source.version} from {from_env} to {to_env}")

    Checkpoint 3 of 4· Fill the gap

    Which function completes this sample, which points the production alias at version 1?

    import mlflow
    mlflow.genai. ? (
        name=f"{uc_schema}.{prompt_name}",
        alias="production",
        version=1
    )

    Rollback uses the same mechanism. Before moving production, record the version it currently points to under a second alias. If the new version misbehaves, point production back to that recorded version. The docs also show other alias schemes: feature-branch aliases (feature-{feature}) and regional aliases (production-us, production-eu).

    A rollback-ready production update that preserves the previous version under its own aliaspython
    # Rollback-ready aliases
    def safe_production_update(name: str, new_version: int):
        """Update production with rollback capability."""
        try:
            # Save current production
            current = mlflow.genai.load_prompt(f"prompts:/{name}@production")
            mlflow.genai.set_prompt_alias(name, "production-previous", current.version)
        except:
            pass  # No current production
    
        # Update production
        mlflow.genai.set_prompt_alias(name, "production", new_version)

    Checkpoint 4 of 4· Exam question

    A nightly ETL job appends newly ingested documents to a Delta table that backs a Delta Sync Vector Search index. The team wants the index to reflect the new rows within minutes of the ETL job finishing, but does not want a streaming pipeline running continuously between batches. Which CI/CD configuration best satisfies this requirement?

    Sources23

    Exam traps

    Each one states something that sounds right. Open it to see what is actually true.

    1. 1.Calling delete_prompt_alias() removes the prompt version the alias pointed to.Why is that wrong?

      Deleting an alias removes only the pointer and keeps the version. Removing versions requires delete_prompt().

      Covered in Prompts as versioned Unity Catalog assets

    2. 2.An agent deployed with Custom Agents can read the Prompt Registry with no extra setup, and its other resources keep automatic credential passthrough.Why is that wrong?

      Custom Agents need manual authentication to reach the registry. Overriding the security environment variables for this turns off automatic passthrough for the agent's other resources.

      Covered in Loading prompts by alias in deployed code

    3. 3.Promoting a prompt to production means registering its template again in a production location.Why is that wrong?

      Promotion points the target environment's alias at the version already tested in the source environment, so nothing is re-registered.

      Covered in Promoting and rolling back across environments

    Sources

    Every claim above is drawn from one of these pages, quoted as it was written on the date shown.

    1. 1.
      “Version and track prompts with Git-like versioning, commit messages, and rollback capabilities”
      ↩︎ Prompts as versioned Unity Catalog assets
      “Aliases: Mutable pointers to specific versions”
      ↩︎ Key concept
      “Remove aliases (versions remain)”
      ↩︎ Exam trap 1
      “Versions: Immutable snapshots with auto-incrementing numbers”
      ↩︎ Checkpoint
    2. 2.
      “A Unity Catalog schema with CREATE FUNCTION, EXECUTE, and MANAGE permissions is required to view or create prompts.”
      ↩︎ Prompts as versioned Unity Catalog assets
      “configure them to load prompts from the MLflow Prompt Registry using aliases rather than hard-coded versions.”
      ↩︎ Loading prompts by alias in deployed code
      “The recommended approach is to use environment variables to make your application flexible and avoid hardcoding prompt references.”
      ↩︎ Loading prompts by alias in deployed code
      “Use a development alias to test prompt changes before promoting to production:”
      ↩︎ Promoting and rolling back across environments
      “Overriding these security environment variables disables automatic passthrough for other resources your agent depends on.”
      ↩︎ Exam trap 2
      “Promote prompts between environments by reassigning aliases:”
      ↩︎ Exam trap 3
      “reassign the production alias to point to a newer version without changing or redeploying your application code.”
      ↩︎ Prediction
      “The MLflow client caches the prompt template, so the prompt registry doesn't introduce latency to your agent.”
      ↩︎ Checkpoint
    3. 3.
      “MLflow automatically tracks the relationship between the prompt version and the application version.”
      ↩︎ Promoting and rolling back across environments

    Continue to page 2 of 2

    Agent CI/CD Pipelines: Vector Search Index Updates and Component Testing

    Spotted a mistake, or was something unclear? Tell us.