TechNuggets Academy

Prompt Engineering

Free Salesforce Agentforce Specialist practice — 6 questions on Prompt Engineering, with explanations. No sign-up. Full 12-question mixed test →

Question 1 of 6 · Prompt Engineering
A company is building an agent to handle complex contract reviews that require analyzing multiple sections, extracting key dates, and validating compliance terms. The agent frequently misses nuanced clauses buried in legal language. Which prompt engineering technique would MOST improve the agent's accuracy for this multi-step analytical task?
Chain-of-thought prompting with explicit sequential decomposition is the most effective technique for complex multi-step analytical tasks. By instructing the model to break down the contract review into discrete steps (identify parties → extract dates → review terms → validate compliance), you create a structured reasoning path that prevents the agent from missing critical elements. This technique is specifically designed for tasks requiring intermediate reasoning steps and dramatically improves accuracy on complex analytical workflows.
Question 2 of 6 · Prompt Engineering
An Agentforce agent is configured to generate product recommendations for an e-commerce platform. During testing, the agent sometimes recommends out-of-stock items despite having real-time inventory data in its grounding context. The prompt currently states: 'Recommend products based on customer preferences and available inventory.' What is the MOST effective prompt modification to eliminate out-of-stock recommendations?
Complex conditional logic and data validation (like inventory status checking) should be handled programmatically through agent actions, not relied upon within prompts. LLMs can be inconsistent with strict constraint adherence, especially under edge cases or when balancing multiple objectives. Moving inventory validation to an Apex action ensures deterministic filtering that executes before recommendations are generated, eliminating the possibility of out-of-stock suggestions. This follows the best practice of using prompts for reasoning and language generation, while delegating precise data operations to code.
Question 3 of 6 · Prompt Engineering
A financial services agent uses grounding data from a Salesforce Data Cloud to answer customer queries about account balances, transactions, and investment portfolios. Customers report that the agent occasionally provides outdated balance information despite fresh data being available. The current prompt includes: 'Use the provided customer data to answer questions accurately.' Which approach would BEST ensure the agent uses the most current data?
The issue stems from how grounding data is retrieved and referenced, not just prompt wording. Configuring the retrieval action (Data Cloud query or API call) to explicitly sort by timestamp descending ensures the freshest data appears first in the context. Then, instructing the prompt to specifically reference 'the first record' or 'most recent data' creates a clear, deterministic link between retrieval order and prompt usage. This combines proper data engineering (sorted retrieval) with clear prompt instructions, addressing the root cause.
Question 4 of 6 · Prompt Engineering
A retail company's Agentforce agent handles customer service inquiries across multiple channels. The agent must maintain brand voice consistency: formal and empathetic for complaints, friendly and casual for general inquiries, and technical but accessible for product troubleshooting. The current single system prompt produces inconsistent tone. What is the MOST scalable solution to achieve dynamic tone adaptation?
Dynamic prompt templates with variable injection offer the optimal balance of flexibility, maintainability, and performance. By classifying the inquiry type once (using intent detection or simple rules), you can inject specific tone instructions into a single prompt template at runtime. This approach keeps all logic in one agent configuration, makes tone guidelines easy to update centrally, and scales efficiently as you add more tone variations. It's the standard pattern for context-dependent prompt customization in production agents.
Question 5 of 6 · Prompt Engineering
A healthcare agent built with Agentforce assists medical staff by summarizing patient charts and suggesting next steps. During validation, clinicians notice the agent occasionally includes irrelevant historical conditions from years ago that are no longer active. The prompt currently instructs: 'Summarize the patient's medical history and current conditions.' Grounding data includes the complete patient record spanning 10+ years. What is the BEST approach to focus the agent on clinically relevant information?
RAG with semantic search optimized for clinical relevance provides the most sophisticated solution. Unlike simple time-based filtering, semantic search can identify which historical information is contextually important (e.g., a resolved condition 3 years ago that's relevant to a new diagnosis) while deprioritizing truly irrelevant old data. RAG retrieves only the most relevant context chunks for the query, naturally filtering out noise. This approach balances recency with clinical relevance and scales better than hard-coded rules as medical complexity varies.
Question 6 of 6 · Prompt Engineering
An Agentforce agent for a SaaS company handles technical support tickets. The agent must escalate to human agents when it detects: customer frustration, requests outside its capability, or security-sensitive topics. The current prompt states: 'Escalate complex issues to human agents.' However, escalation rates are too low, causing customer dissatisfaction. What prompt engineering technique would MOST reliably improve escalation accuracy?
Prompt chaining with a dedicated classifier agent is the most reliable architecture for critical binary decisions like escalation. By separating the escalation decision into a focused classifier prompt optimized solely for that task (with clear yes/no output format), you achieve higher accuracy than mixing escalation logic with response generation. The classifier can be rigorously tested and tuned independently. This pattern is a best practice for high-stakes routing decisions and prevents the main agent from under-escalating due to competing objectives (helpfulness vs. safety).
Ready for the real thing?

The full course: two full-length practice tests, video lessons for every exam domain, hands-on labs and detailed explanations.

$199.99 $34.99 with code FREETEST33 — valid through September 1.

Get my $34.99 deal →