What you will be able to do
- Use traces and evaluation results to identify the failure pattern behind a miscalibrated agent before editing its system prompt
- Rank candidate revisions, from a one-line instruction fix to splitting the work into multiple LLM calls, by how much they add to token cost and maintenance burden
- Choose the smallest revision that fixes the observed failure, then confirm it with versioned prompts and a consistent evaluation set
Key concept
Targeted revision — A change to an agent's system prompt aimed at one failure pattern you have observed, sized to fix that failure and nothing more. You don't rewrite the prompt. The best revision is the one that fixes the failure while adding the fewest tokens to every request and the least text for someone to maintain later.
1.Start from the failure pattern, not the prompt
On the exam, questions in this subdomain give you two things: a system prompt and a description of how the agent misbehaves. For example, it ignores a formatting rule, answers questions outside its scope, refuses things it should handle, or follows an instruction too literally. Before choosing a fix, decide what kind of failure this is. Databricks splits quality problems for retrieval-backed agents into two kinds. Retrieval quality asks whether the right context reached the model. Generation quality asks whether the model used that context well. The docs describe generation problems as ones that show up as hallucinations, inconsistent output, or answers that miss the user's question.
The difference matters because only one of these is a system prompt problem. If the trace shows the retriever returned the wrong chunks, no wording change will fix the answer. Adding instructions just makes every request more expensive and leaves the real problem in place. MLflow traces let you open a failing request and look at each step's inputs and outputs, so you can find the step where things went wrong before you touch any text. Your first job is to confirm that the prompt really is the problem.
Once the prompt is the culprit, the revision should match the symptom. The Databricks evaluate-and-improve tutorial shows one example. Its improved sales-email prompt adds a line saying to follow the user's instructions exactly, tells the model to use customer context only where it is relevant, and tells it to reference customer information only if it is directly relevant to the instructions. That is a small, symptom-specific edit for an agent that ignored instructions and padded its output. The sources do not give a fix for each symptom, so treat the following as a reasoning heuristic. For scope creep or padding, add or tighten one relevance guideline. For over-literal compliance or over-refusal, look first for the one existing instruction that is over-weighted or ambiguous and reword it, rather than adding more rules on top.
The same logic applies when the agent is a Genie agent, where the equivalent of a prompt is its configuration. Databricks says table and column descriptions and synonyms help Genie choose the right column and write more accurate SQL. It says instructions that dictate which tables or columns to use are really the job of descriptions and synonyms. If Genie confuses two similar columns, such as a gross and a net revenue field, the targeted fix is a clearer column description or a synonym, not a new text instruction. The docs also describe prompt matching, which helps Genie match values in a user's question and correct spelling. For a mismatch between how users phrase a value and how it is stored, check prompt matching and example SQL before adding rules. Databricks says to use text instructions only as a last resort, and to put hardcoded-value logic in the data layer or in an example query. A data-layer change such as removing a table is a different lever from a targeted configuration fix, and the docs reserve it for universal rules.
Checkpoint 1 of 8· Check yourself
A RAG agent gives confident but wrong answers. Its trace shows the retrieval span returned chunks unrelated to the question. What is the most appropriate first step?
The trace places the failure in retrieval. Prompt edits would add tokens to every request without supplying the missing context, so the fix belongs in the retrieval component.
“A RAG application can respond poorly despite retrieving the correct context; it can also provide good responses based on faulty retrievals.”Source: docs.databricks.com
Checkpoint 2 of 8· Exam question
A Genie space consistently queries the deprecated table "marketing_v1" instead of the current "marketing_v2" when users ask about marketing performance, because the agent selects tables by name similarity rather than purpose. Which revision resolves this with the least added token cost and maintenance burden?
Correct answer: C — Update each table's description to state its purpose and mark the deprecated one as historical only
- A. Incorrect. A general instruction can suppress this one failure, but it grows the space-wide instruction block, adds tokens to every request, and must be revisited whenever new similarly named tables appear, increasing maintenance burden without fixing the underlying ambiguity.
- B. Incorrect. Rewriting the whole instruction set is the highest-cost option: it increases token count substantially and risks regressing other working behavior, when the failure is isolated to one metadata gap.
- C. Correct. The failure stems from unclear table purpose, not missing instructions. Updating the table descriptions targets the root cause directly, costs almost no extra tokens per request, and requires no ongoing maintenance as new questions arrive.
- D. Incorrect. Removing the table is an infrastructure change beyond prompt revision scope, may break other legitimate uses of the deprecated table, and is a heavier-handed fix than necessary.
- E. Incorrect. Example queries help with query logic and formatting, not table selection ambiguity; adding several of them raises token cost without addressing why the wrong table gets picked.
2.A ladder of revisions, cheapest first
The Databricks evaluate-and-improve tutorial lists common improvement strategies. Prompt engineering covers refining the system prompt for a specific failure, adding explicit guidelines for edge cases, and including examples. Guardrails means validation steps and post-processing in application logic. Reasoning enhancements include breaking a complex task into multiple spans or adding verification steps. The docs list these strategies but do not rank them by cost. The ordering below is this lesson's own rule of thumb: roughly, prefer changes that add the fewest tokens per request and the fewest new parts to maintain. Guardrails break the pattern, because they add code to maintain but little prompt growth. The useful skill is matching the failure to the cheapest strategy that actually fixes it.
| Observed failure pattern | Targeted revision | Added token / maintenance cost |
|---|---|---|
| One instruction is vague, over-weighted, or contradicts another | Reword or remove the offending instruction | Near zero; the prompt may even get shorter |
| Correct in general, wrong on one specific edge case | Add one explicit guideline for that edge case | A sentence per request; one rule to maintain |
| Instruction is understood but output format or style drifts | Include an example demonstrating correct handling | Typically larger: example tokens on every request |
| Output must never violate a hard rule, whatever the wording | Guardrail: validation or post-processing in application logic | Code to maintain; little or no prompt growth |
| One prompt is juggling several complex logic steps | Reasoning enhancement: break the task into multiple spans or calls | Usually highest: extra LLM calls and added latency |
Pay attention to the guardrail row. If a rule must hold on every response (a forbidden output, a required field), restating it in the prompt over and over gives no guarantee and costs tokens each time. A deterministic check in code can be the cheaper and more reliable fix, even though it adds code to maintain. The tutorial describes guardrails as validation in application logic and post-processing before the output reaches users.
Genie agents have their own version of this ladder. Databricks recommends prioritizing SQL expressions and example SQL over text instructions, and describes text instructions as the last resort. Column descriptions and synonyms sit at the cheap end because they are scoped to the agent and shape how Genie picks columns. A complete example query suits a hard, multi-part question. A plain-text instruction is for global context that fits nowhere else, such as a fiscal-year rule or a formatting rule. Choosing the right lever keeps the instruction set small, and Databricks warns that too many instructions can reduce effectiveness.
Checkpoint 3 of 8· Match them up
Match each observed failure to the revision strategy that targets it most directly
Tap a term, then the definition that fits it.
Each strategy fits a different failure. Edge-case guidelines fix narrow misses, guardrails enforce hard constraints in code, and splitting the task helps when one prompt carries too much logic.
“Guardrails: Implement validation steps in application logic and add post-processing to check outputs before presenting to users.”Source: docs.databricks.com
Checkpoint 4 of 8· Exam question
Users asking about "revenue" get totals from the gross_revenue column, but they actually mean net_revenue after returns, so reported figures are consistently too high. What is the most targeted way to revise the agent's configuration to fix this?
Correct answer: A — Add field descriptions and business synonyms clarifying which column corresponds to net revenue
- A. Correct. The failure is column ambiguity, so adding field-level descriptions and synonyms directly maps the business term "revenue" to net_revenue, at a small one-time metadata cost with no per-query token overhead.
- B. Incorrect. A long general instruction enumerating terms grows with every new phrasing users invent, adding tokens to each request and ongoing upkeep, when the fix belongs at the metadata layer.
- C. Incorrect. A separate SQL warehouse changes compute routing, not column selection logic, and does nothing to resolve which column the agent picks.
- D. Incorrect. Shifting the burden to users degrades the natural-language experience the agent is meant to provide and does not fix the underlying ambiguity for anyone who doesn't comply.
- E. Incorrect. A larger model does not resolve a metadata gap; the agent lacks the information to distinguish the columns regardless of reasoning capability, and this adds cost without fixing the cause.
3.Weighing token cost against maintenance burden
Every system prompt token is sent with every request, so a revision that adds a paragraph adds to the cost of the whole workload, not just the failing cases. Databricks treats this as something you measure. Overall latency and token consumption are metrics you compute alongside quality, so you can compare the token count of a proposed revision with the current version before you accept it. Genie agents make the same point: their text instructions and metadata are converted into tokens, and Databricks suggests streamlining descriptions, pruning redundant example queries, and simplifying instructions to cut the count.
The optimized version grew into several numbered sections covering subject identification, clarity and precision, expected format, handling variations, and niche knowledge, plus a closing line telling the model to adhere strictly to the guidelines. It performs better on its evaluation criteria, but it is many times longer, and that length is paid on every call. A quality gain is only one side of the tradeoff, so compare token counts too.
Maintenance burden is the other cost. Every added rule is something a future editor has to understand, keep consistent with the other rules, and re-check when requirements change. Databricks' Genie guidance says to avoid conflicting instructions and to keep consistency across all instruction types, and warns that too many instructions can reduce effectiveness. Splitting work into multiple LLM calls is at the top of the ladder for a reason. The Databricks RAG cookbook says decomposition can improve results but notes that it adds latency in exchange for finer control. Databricks agent design guidance points the same way: start simple and add complexity only when you truly need it.
Checkpoint 5 of 8· Check yourself
Two revisions fix the same failure equally well on the evaluation set. Revision A rewords one existing instruction. Revision B adds a 300-token section of new rules. Which should you choose, and why?
When quality is equal, token consumption and maintenance decide. Token counts are a measured performance metric, so the smaller revision is the better choice.
“Overall latency and token consumption are examples of chain performance metrics.”Source: docs.databricks.com
4.Verify the revision and keep it reversible
A targeted revision only counts once you have shown it works. The MLflow Prompt Registry stores prompts as versioned artifacts in Unity Catalog, with commit messages, aliases, and rollback. Registering each revision as a new version, with a commit message explaining which failure it targets, keeps maintenance manageable. A later editor can see why each rule exists and can roll back a revision that caused a regression.
# Register a prompt template
prompt = mlflow.genai.register_prompt(
name="docs.default.customer_support",
template="You are a helpful assistant. Answer this question: {{question}}",
commit_message="Initial customer support prompt"
)
print(f"Created version {prompt.version}") # "Created version 1"
# Set a production alias
mlflow.genai.set_prompt_alias(
name="docs.default.customer_support",
alias="production",
version=1
)Checkpoint 6 of 8· Fill the gap
You want a later maintainer to see which failure this prompt version was meant to fix. Which parameter records that reason?
prompt_v1 = mlflow.genai.register_prompt(
name=PROMPT_NAME,
template="Summarize this text: {{content}}",
? ="v1: Basic summarization prompt"
)commit_message stores the reason for each version, which is what lets a future maintainer trace a rule back to the failure it was added to fix.
Source: docs.databricks.comRun the old and new versions against the same evaluation dataset, and include the failing cases that prompted the revision as well as cases that already worked. That shows two things: the target failure is fixed, and the change did not break behavior that was correct before. If the evaluation also records token counts, you can see in one comparison whether the revision paid for itself.
Checkpoint 7 of 8· Check yourself
You have revised a system prompt to fix a scope-creep failure. How should you compare it with the previous version?
A fair comparison uses the same data for both versions. Including cases that already worked catches regressions the targeted fix may have introduced. Different traffic or freshly sampled data makes the two versions incomparable.
“Use consistent datasets: Evaluate all versions against the same data for fair comparison.”Source: docs.databricks.com
Checkpoint 8 of 8· Exam question
When a user asks about sales in "Australia," a Genie agent's query returns zero rows because the region column stores three-letter codes like "AUS" rather than full country names. Which revision most directly and cheaply fixes this failure?
Correct answer: A — Enable example values or a value dictionary so the agent maps spoken country names to stored codes
- A. Correct. This is exactly the value-matching failure mode that example values and value dictionaries are designed to solve: the agent learns the mapping once, with no added per-query tokens and no ongoing instruction upkeep.
- B. Incorrect. Spelling out every mapping in a general instruction bloats the prompt with data that belongs in metadata, adds tokens to every request, and must be manually updated whenever new countries appear.
- C. Incorrect. Pushing the mapping burden onto users breaks the natural-language interface and does not fix the agent's behavior for anyone who phrases the question naturally.
- D. Incorrect. Changing the underlying table schema is a data engineering change outside prompt revision scope and may break other systems that depend on the coded values.
- E. Incorrect. Enumerating every code in separate example queries is far higher maintenance than a single value dictionary and does not scale as new codes are added.
Exam traps
Each one states something that sounds right. Open it to see what is actually true.
1.Rewriting the whole system prompt into a comprehensive guideline list is the safest way to fix one observed failure.Why is that wrong?
Databricks recommends targeted changes driven by evaluation results. A full rewrite adds tokens to every request, adds more for someone to maintain, and can introduce new failures in behavior that already worked.
Covered in A ladder of revisions, cheapest first
2.Any wrong answer from an agent means the system prompt needs more instructions.Why is that wrong?
Bad responses can come from faulty retrieval even when generation is fine. Check the trace first; a prompt edit cannot supply context that was never retrieved.
3.Splitting one prompt into several chained LLM calls is a low-cost fix for any instruction-following problem.Why is that wrong?
Decomposition can improve control, but it adds LLM calls and latency. Use it when one prompt really is carrying too much logic, not as a first response to a single misworded instruction.
Sources
Every claim above is drawn from one of these pages, quoted as it was written on the date shown.
- 1.
“Issues here can manifest as hallucinations, inconsistent output, or failure to directly address the user query.”
↩︎ Start from the failure pattern, not the prompt - 2.
“Investigate failing traces, find errors, examine span trees, pinpoint root causes”
↩︎ Start from the failure pattern, not the prompt - 3.
“Only reference customer information if it's directly relevant to the user's instructions”
↩︎ Start from the failure pattern, not the prompt“Refine system prompts to address specific failure patterns, add explicit guidelines for edge cases, include examples demonstrating correct handling”
↩︎ A ladder of revisions, cheapest first“Reasoning enhancements: Break complex tasks into multiple spans, implement chain-of-thought techniques, or add verification steps for critical outputs.”
↩︎ A ladder of revisions, cheapest first“When creating an improved version, focus on targeted changes based on evaluation results.”
↩︎ Key concept“When creating an improved version, focus on targeted changes based on evaluation results.”
↩︎ Exam trap 1“Guardrails: Implement validation steps in application logic and add post-processing to check outputs before presenting to users.”
↩︎ Checkpoint - 4.
“Quality column descriptions and synonyms help Genie understand the column better, choose it for relevant questions, and write more accurate SQL.”
↩︎ Start from the failure pattern, not the prompt“Prompt matching allows Genie to match values that are most relevant to the user's question and correct spelling issues in user prompts.”
↩︎ Start from the failure pattern, not the prompt“Use text instructions only as a last resort”
↩︎ A ladder of revisions, cheapest first“Avoid conflicting instructions: Ensure consistency across all instruction types.”
↩︎ Weighing token cost against maintenance burden - 5.https://www.databricks.com/blog/data-dialogue-best-practices-guide-building-high-performing-genie-spacesSecondary source
“Dictate which tables or columns to use. This is the job of Table/Field Descriptions and Synonyms.”
↩︎ Start from the failure pattern, not the prompt“Hardcode specific values. This logic belongs in the data layer or in a specific Example Query.”
↩︎ Start from the failure pattern, not the prompt - 6.https://docs.databricks.com/aws/en/agents/tutorials/ai-cookbook/evaluate-assess-performanceOfficial docs
“Overall latency and token consumption are examples of chain performance metrics.”
↩︎ Weighing token cost against maintenance burden“A RAG application can respond poorly despite retrieving the correct context; it can also provide good responses based on faulty retrievals.”
↩︎ Exam trap 2“A RAG application can respond poorly despite retrieving the correct context; it can also provide good responses based on faulty retrievals.”
↩︎ Checkpoint - 7.
“Although this approach may add some latency to the overall process, it can allow for more fine-grained control”
↩︎ Weighing token cost against maintenance burden“Although this approach may add some latency to the overall process, it can allow for more fine-grained control”
↩︎ Exam trap 3 - 8.
“When building any AI-powered application, start simple.”
↩︎ Weighing token cost against maintenance burden - 9.https://docs.databricks.com/aws/en/mlflow3/genai/prompt-version-mgmt/prompt-registry/automatically-optimize-promptsOfficial docs
“Adhere strictly to these guidelines to maintain consistency and quality in your responses.”
↩︎ Weighing token cost against maintenance burden - 10.
“Simplify instructions: Verify that your instructions are clear and concise. Avoid unnecessary words.”
↩︎ Weighing token cost against maintenance burden - 11.
“Version and track prompts with Git-like versioning, commit messages, and rollback capabilities”
↩︎ Verify the revision and keep it reversible - 12.https://docs.databricks.com/aws/en/mlflow3/genai/prompt-version-mgmt/prompt-registry/evaluate-promptsOfficial docs
“Document changes: Use meaningful commit messages to track why changes were made.”
↩︎ Verify the revision and keep it reversible“Use consistent datasets: Evaluate all versions against the same data for fair comparison.”
↩︎ Checkpoint