Courseiva

Databricks-GenAI-Assoc Assembling and Deploying Apps Practice Question

A team is using `databricks.agents.deploy()` to publish a Mosaic AI Agent to a serving endpoint. They must expose an environment-specific Vector Search index name and the endpoint name to the deployment without hardcoding values in the notebook, and the same notebook must run in dev and prod. Which approach should the engineer use?

⚠ Common exam trap

The trap here is reaching for ad hoc environment detection instead of using Databricks' built-in parameterization for deployment targets.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

✓

Read the values from `dbutils.widgets` defined at the top of the notebook and pass them into `databricks.agents.deploy()`.

The cleanest way to run one notebook across dev and prod is to parameterize it with notebook widgets, which jobs and Databricks Asset Bundles can populate per target. The values then flow into `databricks.agents.deploy()` so the Vector Search index and endpoint names differ by environment without code changes. Duplicated notebooks, host-string branching, and Delta-table config stores all introduce drift or fragility that the scenario's requirements exclude.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • ✗

    Store the values in a Delta table and have the notebook query that table at deploy time.

    Why it's wrong here

    Using a Delta table as a configuration store adds a runtime dependency and requires the deploying identity to read that table, yet it still does not integrate with the deployment tooling that selects environments. It also duplicates configuration that Databricks bundles and job parameters already manage. The mechanism is indirect and brittle compared with native parameterization, and it complicates CI promotion.

  • ✓

    Read the values from `dbutils.widgets` defined at the top of the notebook and pass them into `databricks.agents.deploy()`.

    Why this is correct

    Notebook widgets provide parameterized inputs that a Databricks job or bundle can supply per environment, so the same notebook runs in dev and prod with different index and endpoint names. The values flow into `databricks.agents.deploy()` at runtime without editing code. This is the standard Databricks pattern for environment-parameterized deployments and satisfies the no-hardcoding requirement.

  • ✗

    Detect the environment by reading the current workspace URL inside the notebook and branch on it.

    Why it's wrong here

    Inferring the environment from the workspace host embeds fragile string logic into the notebook and breaks when workspaces are renamed or when staging shares a host. It also scatters environment knowledge through the code instead of centralizing it in deployment configuration. This approach works only by accident and does not provide a clean parameterization mechanism for index and endpoint names.

  • ✗

    Hardcode the prod values and use a separate copied notebook for dev with the dev values.

    Why it's wrong here

    Duplicating notebooks with hardcoded values creates drift: fixes must be applied twice, and the two copies can diverge silently. It also violates the explicit requirement that the same notebook run in both environments. While it technically produces working deployments, it is a maintenance anti-pattern that the scenario rules out and that undermines CI/CD reliability.

About these practice questions

This Databricks-GenAI-Assoc question is part of Courseiva's 330-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written and reviewed by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

Last reviewed September 2026 · checked against the official Databricks exam blueprint

This Databricks-GenAI-Assoc practice question is part of Courseiva's free Databricks certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the Databricks-GenAI-Assoc exam.