Flex Instructions Overview
A flex instruction is a plain-language instruction that guides how an agent behaves and communicates. You can write an instruction for a specific agent, such as a business rule like "Never propose a resource who is on leave" or "Prefer candidates from the same practice", or a communication preference like "Summarize results as a bulleted list" or "Keep responses brief and formal". The agent treats the instruction as trusted guidance on every request. Flex instructions enable you to adapt an agent to your organization's ways of working without a code change or a new release.
What You Can Do with Flex Instructions
Flex instructions enable you to:
- Steer an agent's reasoning and apply business rules using plain language, without changing its configuration or code.
- Set communication preferences, such as the tone, the level of detail, or how the agent formats and presents its results.
- Apply an instruction to every request handled by a named agent.
- Tailor different agents independently, because each instruction targets a single agent.
- Adjust an agent's behavior over time by activating a new instruction or deactivating the current one.
How Flex Instructions Work
A flex instruction applies to every request handled by the agent it targets. The agent reads its active instruction at the start of each request and uses it to guide how it responds.
Every agent also has built-in instructions and guardrails that define what it does, how it works, and the limits it operates within. These are part of the agent, and you cannot view or change them in Salesforce. A flex instruction adds your organization's preferences on top of them.
Flex instructions steer how an agent reasons and communicates. They do not block or override the actions the agent can take, and they do not grant the agent new abilities. An agent continues to respect your field-level security and sharing rules, and it still asks you to confirm a change before it saves anything.
One Active Instruction per Agent
Each agent can have only one active instruction at a time. When you activate an instruction for an agent that already has an active one, the following message is displayed, and you must deactivate the existing instruction first:
Another flex instruction is already active for this agent. Deactivate it before activating this one.
Deactivated instructions are retained rather than deleted, so you keep a history of the instructions an agent has followed and can reactivate an earlier one when you need to.
Instruction Length
An instruction can contain up to 5,000 characters. Keep instructions focused and concise so that the agent can apply them reliably.
How Quickly Changes Take Effect
When you activate, deactivate, or edit an instruction, the change takes effect within about a minute. Until then, an agent already in a conversation might continue to apply the previous instruction.
If an Instruction Cannot Be Retrieved
If an agent cannot retrieve its active instruction, it returns an error for that request rather than continuing without the instruction. This ensures that an agent expected to follow a rule does not silently ignore it.
Writing Effective Flex Instructions
To get reliable results from a flex instruction:
- Write for one agent at a time, and keep the instruction relevant to what that agent does.
- State what you want the agent to do, using positive guidance rather than long lists of exceptions.
- Keep the instruction concise, and cover one behavior or a small set of related behaviors.
- Review the agent's responses after you activate an instruction, and refine the wording if the agent does not behave as you intended.
- Use line breaks and lists to structure your instruction. The agent receives these. Bold and italic formatting are not passed to the agent, so do not rely on them to convey meaning.
For the steps to create, edit, and activate an instruction, see Creating a Flex Instruction, Editing a Flex Instruction, and Activating or Deactivating a Flex Instruction. For more information about the fields on the Flex Instruction object, see Flex Instruction Fields.
Flex Instructions Guidance
The Flex Instructions Guidance section of the page suggests a structure for your instructions, with a worked example for each part:
- Business Context, which describes how your organization works.
- Terminology, which explains the words and phrases specific to how your organization refers to things.
- Response Style, which tells the agent how to format and present its responses.
This section is available whether you are viewing or editing an instruction. The section is collapsed or expanded by default the first time you open the Flex Instructions page. You can click Flex Instructions Guidance to hide or display the section. Your preference is retained the next time you open the page.
SECTIONS