Sub topic 10
The LLM gateway
This chapter covers the LLM gateway, the step where a masked and defended prompt leaves Salesforce for a model provider. It assumes you know what grounding and data masking do, which earlier chapters cover. You should also know what a prompt is and have basic familiarity with Salesforce permissions.
What the gateway does
The LLM gateway is the single exit point from the Einstein Trust Layer to a large language model (LLM). Agentforce does not call a model provider directly. Every prompt first passes through secure retrieval, grounding, masking, and prompt defense. The gateway then forwards the finished prompt to the selected model and receives the response.
Putting one gateway in front of all models gives Salesforce one place to apply controls. It also means a model change does not bypass those controls.
What the gateway is responsible for
The gateway has three main jobs:
- Routing. It sends the prompt to the model chosen for the agent or prompt template. That model can be one hosted by Salesforce or by a supported provider.
- Enforcing provider agreements. Salesforce has contracts with model providers that include zero data retention. This means the provider does not store prompts or responses after generating the output, and does not use them to train its models. The next chapter covers this in detail.
- Passing the response back. The response returns through the gateway to the later Trust Layer steps, namely toxicity detection and demasking.
What the model sees
By the time the prompt reaches the gateway, sensitive values have already been replaced. Take the example from the masking chapter:
Summarize the case for PERSON_0 (EMAIL_0).
Her order 55501 arrived damaged.The provider receives only this text. It never receives the real name or email address. Notice that the order number 55501 is still present. Masking only covers the value types it is configured to detect, so the gateway cannot protect data that earlier steps left in the prompt.
Common errors
- Assuming the gateway masks data. Masking happens before the gateway. The gateway transports what it is given.
- Assuming the gateway fixes bad grounding. If a prompt includes data the user should not see, the gateway forwards it. Permissions are enforced earlier, during retrieval.
- Treating all model paths as identical. Which model you choose changes who processes the prompt. The model options chapter covers that.
- Expecting a fixed internal order. The numbered pipeline in this tutorial is simplified, and details vary by feature and release.
Why this matters for admins
Because every model call goes through the gateway, you can reason about data exposure at one boundary. Ask what the prompt contains when it leaves, which provider receives it, and what the agreement with that provider says. Your own configuration still decides what reaches that boundary, such as which fields are grounded and which masking settings are enabled.
Exercise
A prompt reaches the LLM gateway containing an unmasked phone number that the configured masking did not detect. Does the gateway remove it? Which earlier control would you review?
Show answer
No. The gateway forwards the prompt it receives and does not mask data. Review the data masking configuration, and also which fields are grounded into the prompt, because masking only covers the value types it is set up to detect.