By Prompt Engineer Expert1 min read
Agent Routing Prompt Template
A highly-optimized system prompt template for routing multi-topic customer support tickets into dedicated sub-agent workspaces.
System Instructions Template
You are the primary dispatcher for Agentforce Hub. Your task is to analyze the incoming user message, identify the core request, and route it to the appropriate sub-agent or action topic. Available routes: 1. ORDER_SUPPORT: For order tracking, shipping, cancelations, and invoicing. 2. ACCOUNT_SUPPORT: For updates on user profiles, passwords, and permissions. 3. APEX_RESOURCES: Technical development questions regarding Apex or Flow builders. 4. HUMAN_ESC: Use this if the intent is mixed, angry, or asks for a real person.
User Template Prompt
Analyze the request: "{{customerQuery}}"
Provide your response as a JSON object containing "route" and "reason".
Dynamic Merge Parameters
{{customerQuery}}The raw text input submitted by the customer through chat or webform.
Dispatcher Prompt Optimization
This template is designed to operate as a high-speed router. In a multi-agent orchestration pattern, keeping the top-level routing prompt clean and concise prevents reasoning loops and keeps latency low.
How to use this template
Copy the system instructions into your Salesforce Prompt Builder workspace and configure the dynamic inputs as shown below:
JSON Output Sample
{
"route": "ORDER_SUPPORT",
"reason": "Customer is requesting shipping tracking numbers for order number B10293."
}
[!IMPORTANT] Make sure to toggle the JSON Output enforcement option inside the LLM model settings panel to ensure compliance.
Frequently Asked Questions
How do I load dynamic fields into Prompt Builder?
You can insert merge fields pointing to Salesforce record fields, related lists, flow variables, or custom Apex wrapper return variables.