Sub topic 3
The Einstein Trust Layer in the request path
This chapter assumes you know what an Agentforce agent, topic, and action are, and that you have a general idea of how a large language model (LLM) takes a prompt and returns text. You do not need to have built a retriever yet. Later chapters cover that. Here the goal is to see where the Einstein Trust Layer sits when a grounded prompt travels from Salesforce to an LLM and back.
What the Trust Layer is
The Einstein Trust Layer is a set of services that wraps calls from Salesforce to an LLM. Its job is to control what data leaves your org in a prompt, how the model provider may handle it, and what comes back before a user sees it. It applies to prompts built from prompt templates and to prompts that agents generate while reasoning.
The Trust Layer matters for grounding because retrieval makes prompts richer. A grounded prompt contains excerpts from your Knowledge articles, and sometimes customer details. Those excerpts are exactly the content you want to protect on the way to the model.
The Trust Layer does not decide which content is retrieved. The search index, the retriever, and its filters do that. It also does not fix a prompt that grounds poorly. It acts on whatever prompt arrives.
The request path, step by step
A grounded request passes through these stages. The exact feature set depends on your org's configuration and release, so confirm details in current Salesforce documentation.
- Prompt assembly. A prompt template or agent action collects the user's question, any merge fields, and the retriever results. This produces the full prompt text. Retrieval happens here, before the Trust Layer acts.
- Secure data retrieval. Content is fetched using the running user's access. Sharing and field-level security still apply to CRM data merged into the prompt.
- Data masking. If masking is enabled, the Trust Layer detects configured types of sensitive data in the prompt and replaces them with placeholders.
- Prompt defense. Instructions are added to help the model stay within its task and resist attempts to override it.
- LLM gateway. The gateway sends the masked prompt to the model provider. Contracts with providers include zero data retention terms, meaning the provider does not store the prompt or response for training.
- Toxicity detection. The response is scored for harmful content.
- Demasking. Placeholders in the response are replaced with the original values.
- Audit trail. Prompt, response, and related metadata are recorded, when you have set up auditing in Data Cloud.
Notice that the retriever runs before the Trust Layer. Masking therefore sees the retrieved Knowledge text as well as the user's question.
Data masking and grounded content
Masking works on patterns and categories, such as names, email addresses, phone numbers, and payment card numbers. You choose which categories to mask in Einstein Trust Layer setup. Some points matter for grounding:
- Masking is pattern-based, so it can miss data that does not look like the configured types, and it can occasionally mask text that is not sensitive.
- Knowledge articles often contain product names, contact addresses, or sample phone numbers. If these match a masked category, the model sees placeholders instead. The answer can then look odd or lose a detail, even though retrieval worked.
- Demasking restores values in the final response only when the model keeps the placeholder in its output. If the model paraphrases around a placeholder, the restored text may read awkwardly.
If an answer drops a support phone number that exists in the article, check masking settings before you change the retriever.
Zero data retention and what it covers
Zero data retention is a contractual commitment with model providers accessed through the Trust Layer. It covers the prompt and response at the provider. It does not mean nothing is stored anywhere. Your own org can store audit and feedback data in Data Cloud, which is why that storage needs its own access control and retention planning. Chapter 17 returns to this.
Models you bring yourself, outside the Salesforce-managed gateway, may not carry the same terms. Check each model's setup before assuming the protections apply.
What the Trust Layer does not do
| Concern | Trust Layer role | Where it is actually handled |
|---|---|---|
| Which articles are retrieved | None | Search index, retriever, and filters |
| Whether the answer stays within retrieved content | Limited. Prompt defense helps with misuse, not with relevance. | Prompt and topic instructions |
| Who may see an article | Not an article-level control | Retriever filters, Knowledge access, and sharing design |
| Hallucinated facts in the answer | Toxicity detection does not check accuracy | Grounding, instructions, and testing |
| Stale content | None | Ingestion and index refresh |
Treat this table as a reminder that the Trust Layer is a safety layer around the call. It is not a substitute for good retrieval.
Common errors
- Assuming masking protects Knowledge text by default. Masking must be configured. Check which categories are on.
- Blaming retrieval for a missing detail. A masked value that the model failed to restore looks like a retrieval gap. Compare the stored prompt with the response.
- Expecting the Trust Layer to enforce article visibility. If an article should not reach certain users, restrict it at the retrieval step.
- Treating a clean toxicity result as proof of accuracy. The check measures harmful content, not truth.
- Skipping the audit setup. Without it, you cannot inspect what was sent for a bad answer.
Example: reading a trace
Suppose a customer asks, "How do I reach billing support?" The article says "Call 555-0142 or email [email protected]." The answer says, "You can reach billing support by phone or email," with no details.
A sensible diagnosis order:
- Confirm the retriever returned the article. If it did, retrieval is not the problem.
- Open the audit data for the request and look at the prompt as sent to the model. If it contains placeholders in place of the number and address, masking replaced them.
- Check whether the response contained those placeholders. If it did not, the model omitted them, so demasking had nothing to restore.
- Adjust masking categories if the contact details are not sensitive in your context, or add an instruction to repeat contact details exactly as written.
Exercise
A grounded answer leaves out a phone number that appears in the retrieved Knowledge article. The retriever test shows the article is returned. Name two Trust Layer stages that could explain the missing number and one check for each.
Show answer
Data masking and demasking. For masking, inspect the prompt sent to the model (through the audit trail) to see whether the number was replaced by a placeholder. For demasking, inspect the raw model response to see whether the placeholder was kept. If the model dropped it, there was nothing to restore, so adjust masking categories or add an instruction to repeat contact details exactly.
Exercise
A team says the Trust Layer will stop customers from seeing internal-only articles in answers. Is that correct? What should they do instead?
Show answer
No. The Trust Layer masks data and screens responses. It does not decide which articles are retrieved. They should control visibility at retrieval, for example with retriever filters on a field such as an audience or channel value, and with appropriate Knowledge access design.