Prompt Optimizer
AI funding and usage
AI included uses REDA credits. Bring your own AI uses your organisation’s provider account, billed directly by that provider. The licence selects one funding model for the organisation. In either model, REDA AI governs configured tools and actions in Salesforce. Set up your licence and AI accounts.
In customer-account mode, the selected model determines which Deep Reasoning levels and capabilities are available. Review the AI Account selector’s supported levels and warnings; do not assume every provider supports the same combination. Admin AI tools and document processing use the organisation default connection. Configure the default and test the workflow.
What It Does
The Optimizer is the AI-assisted counterpart to the Quality Analyzer. The analyser tells you what’s wrong; the Optimizer proposes a fix. The result is a single rewritten prompt body you can review, edit and save.
Unlike the analyser, the Optimizer calls the model and consumes credits. In return you get an actual rewrite, not just a list of issues.
What Comes Back
| Field | Meaning |
|---|---|
optimizedContent | The rewritten prompt body, ready to save back to the record. |
summary | A short explanation of what was changed and why. |
tokensBefore / tokensAfter | Token counts on the original and the rewrite. |
qualityBefore / qualityAfter | Quality scores from the Quality Analyzer on each version. |
creditsUsed | Actual credits consumed by the optimisation call. |
The summary explains the rewrite at a high level — what was cut for verbosity, what was reorganised for structure, what was removed as redundant. Read it before applying so you can spot anything that doesn’t fit your intent.
What the Model Sees
The Optimizer is not just paraphrasing the prompt in isolation. It receives a structured request that includes:
- The original prompt content — the text being optimised
- The prompt type — persona, instruction, schema, etc., so the rewrite follows the right shape
- The channel — customer-facing channels favour safety, brevity and friendly tone; internal channels can be denser and more technical
- The agent definition when one is supplied — persona, display name, channel, so the rewrite stays on-purpose
- Sibling prompts on the same agent — so the Optimizer doesn’t duplicate instructions already living in another prompt
- The agent’s assigned tools — so the rewrite reflects what the agent can actually do
- An optional user instruction — free text from you that steers the rewrite (“cut by half”, “add a step about confirmation”, etc.). You can enter up to 15,000 characters, and the full instruction reaches the model.
- An optional sample file — attach a representative document (PDF, image, CSV, TXT, or JSON) the agent will process at runtime. The Optimizer reads it to tailor the prompt to that document’s structure (which fields to extract, expected formats), treating it as a sample of runtime input rather than copying its contents into the prompt.
The output is intentionally just the rewritten prompt — no explanations or surrounding markdown — so it can be saved back to the record without manual cleanup. The platform also strips any code-fence markers in case the model adds them.
Channel-Aware Optimisation
Optimisation goals differ by channel:
- Customer-facing channels (External Widget, Community) get rewrites that emphasise safety, brevity and friendly tone — tighter language, fewer assumptions about insider knowledge.
- Internal channels get rewrites that can be denser, technical and detailed — the audience is users with full Salesforce context.
- API channels get rewrites tuned for automated callers — shorter, more deterministic, less conversational.
The platform sends the agent’s configured channel to the Optimizer automatically; you don’t set it separately.
How a Run Works
-
Open a prompt
Or you call the Optimizer directly from the prompt record’s actions menu.
-
Add an instruction
A short user instruction lets you steer the rewrite — e.g. “halve the length”, “split into sections”, “keep the example list intact”.
-
Click Optimize
The platform composes the request, sends it to the model and waits for the rewrite.
-
Compare before and after
The UI shows the original alongside the rewrite, the token-count delta, and the quality-score delta.
-
Review the summary
A one-paragraph explanation tells you what changed.
-
Apply, edit or discard
Save the rewrite as-is, edit it inline, or close the dialog without keeping it. Nothing changes until you commit.
Truncation Detection
Long prompts can produce optimisation outputs that exceed the response budget. The platform detects when the rewrite was cut off mid-flow and surfaces a clear error rather than persisting an incomplete prompt:
“The optimized prompt was truncated due to output token limits. Try shortening the original prompt, or increase "Optimizer_Max_Output_Tokens" in REDA AI Setup.”
The message names the fix: Optimizer Max Output Tokens is a Platform Setting, 4096 by default. Raising it lets the rewrite finish. Splitting the prompt is the other option, and the better one when the prompt is genuinely doing too much.
If you hit this consistently on a single prompt, the prompt is probably trying to do too much — split it into multiple Custom Prompts (each with a focused job) and optimise each one separately.
A truncated run still costs credits. The tokens were consumed before the cut-off, so REDA AI logs the transaction even though no usable rewrite came back.
Timeout Handling
With AI included, a callout timeout can incur the documented 20-credit charge. With Bring your own AI, REDA does not deduct a credit allowance; your provider controls its billing. Check the recorded usage and the error before retrying. A timeout by itself does not establish the cause.
Credit Cost
The cost scales with input size (the prompt being optimised, plus the agent context, sibling prompts and tool list) and the size of the rewrite. The platform reports the actual credits consumed after the run.
Smaller prompts cost less, but the wins are also smaller; oversized prompts cost more, but they’re also where the rewrite typically pays for itself within a few real conversations.
What the Optimizer Does Not Do
- It doesn’t auto-apply. Every rewrite is reviewable; nothing is saved until you commit.
- It doesn’t change semantics intentionally. The model is asked to keep the prompt’s meaning — cuts target verbosity, not the substance of what you wrote. Always read the summary before applying.
- It doesn’t analyse cross-prompt conflicts. The Optimizer is aware of sibling prompts so it doesn’t duplicate, but it doesn’t resolve contradictions between prompts — for that, read the conflict report in Agent Runtime Preview.
- It doesn’t replace the analyser. Rewrites are still scored after the fact, so the analyser is the source of truth on quality.
How It Differs From Related Features
- Quality Analyzer — scores prompts deterministically. Free, instant, no model call.
- Build Agent with AI — reviews the agent end-to-end and proposes edits across persona, prompts, context, tools and chips. Use it for breadth.
- Prompt Optimizer — rewrites a single prompt with channel- and tool-aware context. Use it for depth on a specific prompt that’s scored low or grown over time.
Use the Quality Analyzer to find the prompts to optimise; use the Optimizer to do the rewrite; use the Runtime Preview to verify the rewritten prompt still fits the agent’s overall picture.
Best Practices
Read the summary every time. “Cut verbose phrasing, removed redundant rule about being concise, added section header” is a good summary; “rewrote for clarity” is a vague one. Vague summaries deserve a closer look at the diff.
Use the user instruction. One sentence of guidance often produces a noticeably better rewrite than running the Optimizer with no instruction.
Optimise low-scoring prompts first. The Quality Analyzer flags the worst offenders; the Optimizer’s ROI is highest on those. A prompt scoring 95 doesn’t usually need rewriting.
Don’t blindly accept big cuts. A rewrite that drops the token count by 70% probably deleted something important. The summary should explain the cut; if it doesn’t, read both versions carefully.
Re-run the Quality Analyzer mentally. The before/after quality scores tell you the analyser’s view; your own judgement on whether the rewrite still says what you mean is the other half of the call.
Frequently Asked Questions
No. It returns a rewrite for review. Nothing is saved until you click apply. You can also edit the rewrite before saving.
So the rewrite doesn’t duplicate instructions you already have somewhere else. If the agent already has a guardrail prompt, the Optimizer can safely strip a redundant guardrail from the prompt being optimised.
So the rewrite reflects what the agent can actually do. A prompt that mentions a workflow the agent has no tool to execute is worse than useless — the Optimizer flags or removes those references.
Skip it. The before/after quality scores and your own read of the diff are the deciding inputs. If the rewrite is genuinely worse, discard it and either retry with a clearer user instruction or leave the original alone.
You can run the Optimizer on any Custom Prompt, but the built-in language directives are already tuned for token efficiency — ~20–40 tokens each — so there’s rarely a meaningful win there. See Multi-Language Agents.
The Optimizer’s response budget was hit before the rewrite finished. That usually means the original prompt is very large — split it into smaller, focused prompts and optimise each one separately.
Use the user-instruction field to tell the Optimizer what to keep — e.g. “keep the example list intact” or “preserve the exact wording of section 3”. Specific instructions reliably constrain the rewrite.
Next Steps
Browse the Prompt Template Gallery for ready-to-use starting points, or revisit the Quality Analyzer to triage which prompts are worth optimising.