Prompt templates as Agentforce actions
Key Takeaway
To let an Agentforce agent use a prompt template, create a custom agent action that references the template. The action returns text generated by an LLM, so it's probabilistic. Flows, Apex methods and APIs are more deterministic.
You can turn a prompt template into an agent action. An Agentforce agent can then ask a large language model (LLM) to generate text as one step in a conversation. For example, the agent can write a short summary of an opportunity. To set this up, you create a custom agent action that references the prompt template. Then you tune the action's description, inputs and outputs so the agent knows when and how to use it.
What a custom agent action wraps
A custom agent action wraps existing Salesforce functionality, which is called the reference action. The reference action can be any of these:
- An invocable method or REST Apex class
- An external service
- An autolaunched flow
- A MuleSoft API
- A prompt template
When the reference action is a prompt template, the custom agent action is a prompt template action.