Concept
- When an AI agent misbehaves, developer instinct is often to add more instructions. In practice, this usually makes performance worse.
- Every line in your system prompt increases the context size that the model must evaluate during reasoning.
- Overlapping or wordy instructions create priority conflicts, leading to unpredictable agent execution.
- Official Salesforce guidance explicitly recommends shorter reasoning instructions for reliable and accurate outcomes.
- The most effective fix for erratic agent behavior is trimming prompt text rather than expanding it.
- For strict rules that must never fail, remove them from prompt prose and enforce them inside code logic or an
after_reasoningguard layer. - Use a targeted
system.instructionsoverride on a per-subagent basis to prevent global prompt clutter. - Practical Method: Cut your system instructions in half, re-run your evaluation test suite, and compare accuracy scores.
🧭 360 Card — Why Shorter Instructions Win
Rule: Shorten prompt text first. Only introduce new instructions after proving that trimming did not solve the problem.
Gain: Higher routing accuracy, lower token costs per interaction, and faster response times.
Price: It feels counter-intuitive. Reducing instructions to fix an error goes against standard developer habits and can be hard to explain to teams.
Limits: Critical business constraints cannot always be edited away. Move those non-negotiables into code logic instead of system prompts.
Mirror (Verbose vs. Concise): Detailed, lengthy instructions look comprehensive on paper, but perform worse in automated evaluation tests.
Later: Treat prompt optimization as a measurable experiment. Document performance before and after trimming to build concrete case studies.
At Volume: Unnecessary prompt length scales API costs exponentially across high-volume chat traffic.
Core Q&A
Q: Your agent routes correctly but gives inconsistent answers. What do you change first?
A: Start by removing text rather than adding to it.
- Longer prompts force the model to weigh too many variables, increasing the likelihood of partial compliance.
- Salesforce best practices show that concise reasoning prompts lead to higher accuracy and better repeatability.
- Reduce instruction length by 50%, execute the same benchmark test set, and compare accuracy metrics.
- Extract mandatory rules out of written prose and implement them via code logic or an
after_reasoningvalidation layer. - If a specific subagent requires unique formatting or rules, use a localized
system.instructionsoverride instead of polluting global prompt text. - Providing clear before-and-after performance metrics demonstrates strong data-driven engineering practices.
📝 2-Minute Self-Check
Q1. What does the AI model actually evaluate during execution?
A1. The compiled English prompt assembled by your application logic, not the underlying source code script.
Q2. Where should you place a non-negotiable rule that can never be bypassed?
A2. Inside deterministic application code or an after_reasoning guard, never in plain prompt sentences.
Q3. When does an after_reasoning guard fail to execute?
A3. When a subagent delegates control or transfers execution mid-way through its reasoning loop.