Live Salesforce Training & Pre-Recorded Videos Available | Admin • Development • LWC • Agentforce • Data 360 • Integration • Job-Ready Sessions | Contact us for more info +91 - 709 7777 111
Welcome to SfdcIndia

Agentforce Sub Agent

Agentforce Sub Agent

Agentforce Sub Agent

1. WHAT IS A SUBAGENT

A subagent is one specific job that an Agentforce agent can do.

An agent has multiple subagents. Each subagent handles a specific type of work. Together, they decide what the agent can do.

If the user's request does not match any subagent, the agent may not know how to handle the request correctly.

Simple Example's :
Company = Agent Departments = Subagents Employee tools = Actions
In Simple terms, One Subagent = One Clear Business Job.
EMPLOYEE SUPPORT AGENT :
EMPLOYEE SUPPORT AGENT │ ┌───────────────────────────┼──────────────────────────┐ │ │ │ ▼ ▼ ▼ LEAVE MANAGEMENT PAYROLL EMPLOYEE SERVICES SUBAGENT SUBAGENT SUBAGENT │ │ │ │ │ │ ├─ Check Leave Balance ├─ Get Salary Details ├─ Update Employee Details ├─ Apply Leave ├─ Download Payslip ├─ Get Company Policy ├─ Cancel Leave ├─ Check Bonus Details ├─ Raise HR Request └─ Check Leave Status └─ Update Bank Details └─ Check Request Status
Hospital Assistant Agent :
HOSPITAL ASSISTANT AGENT │ ┌────────────────────────┼────────────────────────┐ │ │ │ ▼ ▼ ▼ APPOINTMENT MANAGEMENT PATIENT MANAGEMENT BILLING MANAGEMENT SUBAGENT SUBAGENT SUBAGENT │ │ │ ├─ Book Appointment ├─ Check Patient Details ├─ Generate Bill ├─ Check Doctor Availability ├─ Create Patient Record ├─ Check Payment Status ├─ Reschedule Appointment ├─ Update Patient Record ├─ Get Bill Details ├─ Cancel Appointment ├─ Get Patient History ├─ Apply Insurance Details └─ Send Appointment Reminder └─ Get Lab Report └─ Send Payment Receipt
Banking Agent :
BANKING ASSISTANT AGENT │ ┌──────────────────────────┼──────────────────────────┐ │ │ │ ▼ ▼ ▼ ACCOUNT MANAGEMENT LOAN MANAGEMENT CARD MANAGEMENT SUBAGENT SUBAGENT SUBAGENT │ │ │ │ │ │ ├─ Check Account Balance ├─ Check Loan Eligibility ├─ Check Card Status ├─ Update Customer Details ├─ Create Loan Application ├─ Block Card ├─ Get Account Statement ├─ Check Loan Status ├─ Request New Card └─ Block Account └─ Calculate EMI └─ Check Card Transactions
Old name: "Topic". From April 2026, Salesforce renamed Topics to Subagents. Functionality is the same. The old "Topic Selector" is now called the "Agent Router". Older documents and metadata still use the word "topic"; it means the Subagent.
2. WHERE A SUBAGENT SITS IN THE AGENT

Level 1 - Agent : The full assistant (Employee Agent, Service Agent, etc.). Holds the role, system messages, language settings and channels.

Level 2 - Subagents (Here AGENT ROUTER will pick the Related Sub Agent) : The jobs the agent can do.

Level 3 - Actions : The tools each subagent uses to do its job.

3. PARTS OF A SUBAGENT

a) Name :A short, clear label for the job.

b) Description (Classification Description) : Tells the Agent Router WHEN to use this subagent.
This is the most important field. Routing depends mainly on it. A weak description sends requests to the wrong subagent.

c) Scope : What the subagent is allowed to do, and what it must NOT do.

Example: "Handles order status and cancellation only. Does not handle refunds or returns."

d) Instructions : Rules for the subagent follows while working:

  • business logic
  • guardrails (what not to say or do)
  • order of steps
  • when to ask the user for more details
  • tone and format of answers

e) Agent Actions : The actual action definitions owned by the subagent (Flow, Apex, Prompt Template, API, MCP tools).

Key point: If two subagents have similar descriptions, the router gets confused and may pick the wrong one or behave inconsistently.
4. TYPES OF SUBAGENTS
a) Standard subagents :

--> Provided by Salesforce for common use cases. Examples: General FAQ, General CRM, etc..

--> You can add it from the Asset Library and customise the copied version.

b) Custom subagents :

--> Created by us for our own business requirement.

--> Created in Setup > Agentforce Assets > Subagents. (Library)

--> Created directly inside one agent in Agentforce Builder. (Local)

c) Connected Subagent :

--> This is different from a normal subagent.

--> Here, another complete Agentforce Agent is connected to the current agent as a subagent.

--> Salesforce supports this through multi-agent orchestration.

Example :

Main Enterprise Agent | | Sales Agent Service Agent HR Agent Finance Agent
d) Sub Agent from App Exchange or AgentExchange:

--> Its a ready-made subagent created by Salesforce or a another partner.

--> We can install the package, bring the subagent into our org, and then add it to our agent from the Asset Library.

e) Agent Router :

--> This is a special system/start subagent.

--> Its main responsibility is: Understand the user request → select the correct subagent.

--> Salesforce automatically adds an Agent Router when creating an agent.

5. How Many Ways We can Create a Custom Subagent?
CREATE CUSTOM SUBAGENT │ ┌────────────────────┴──────────────────────┐ │ │ ▼ ▼ AGENTFORCE BUILDER ASSET LIBRARY │ │ ┌──────┼──────────────┐ │ │ │ │ │ ▼ ▼ ▼ ▼ Canvas View Agent Script AI assistance New Subagent
1. Create inside New Agentforce Builder :

--> This subagent belongs only to that particular agent/version.

We can create it in 3 ways:

  1. Canvas View – manually create the subagent.
  2. Script View – define the subagent through Agent Script.
  3. Ask AI assistance – describe what you need, and AI Assistance can generate the subagent and related actions for you.
2. Create from Agentforce Asset Library :

--> This is useful when you want the same subagent to be available for multiple agents or agent versions. (Setup → Agentforce Assets → Subagents → New Subagent)

--> If we delete a Subagent from Agentforce Assets, the Subagent version already added to an Agent will still remain and continue to work in that Agent.

--> Why? When you add a subagent from Agentforce Assets / Asset Library to an agent, Salesforce creates an independent copy inside that agent version. So deleting the original asset does not delete the copies already used by agents.

--> If we update a Subagent in Agentforce Assets, it will not automatically update the Subagent already added to an Agent, Because The Subagent inside the Agent is treated as a separate copy/version.

--> Changes made to the original Subagent in Agentforce Assets are not automatically synced to existing Agents.

--> To use the latest changes, open the Agent in Agentforce Builder, Add the updated Subagent again from the Asset Library / Agentforce Assets.

6. EXAMPLE OF A WELL-DESIGNED SUBAGENT :
Name:

Order Management

Description:

Handles questions about existing orders, including order status,
delivery date, and order cancellation. Use when the user mentions
an order, order number, shipment, delivery, or wants to cancel.

Scope:

In scope: order status, delivery tracking, cancelling orders that
are not yet shipped.

Out of scope: refunds, returns, product recommendations,
billing disputes.

Instructions:
  1. Always ask for the order number if it is not provided.
  2. Use "Get Order by Number" to fetch order details.
  3. If status is "Shipped", do not allow cancellation; explain why.
  4. Before cancelling, confirm with the user.
  5. Never share payment card details.
Actions:
  • Get Order by Number (Flow)
  • Cancel Order (Apex)
7. Subagent Limitations / Considerations :
  1. Size limits: Too many Subagents can reduce the Agent performance.(Recommended: around 10 Subagents per Agent and around 10 Actions per Subagent.)
  2. Actions have a time limit. If a Flow or Apex action takes longer than 60 seconds, it fails.
  3. Asset updates do not automatically sync : If a Subagent is added from Agentforce Assets, later changes to the original asset do not automatically update the Agent copy.
  4. Some advanced features require Script View. Ex : Custom Lightning Types for Action inputs/outputs are not supported in Canvas View.
  5. Wrong routing: similar descriptions confuse the agent.
7. Common Errors and Solutions :
Error 1 — Wrong Subagent Is Selected.
Reason: Sub Agent Descriptions are too similar.
Solution: Need to provide clear Descriptions( What this subagent handles + What this subagent does NOT handle)
Error 2 — Subagent Is Never Selected.
Solution: Need to Check Agent Router, Transitions, Instructions.
Error 3 — Correct Subagent Selected but Action Not Called
Solution : Need to Check below things
--> Is the action added?
--> Is it available for reasoning?
--> Are the instructions clear about when to use it?
--> Are required inputs available?
Error 4 — Works for Admin but Not Real User
Solution : Need to Check below things
--> Object permissions
--> Field permissions
--> Record access
--> Flow access
--> Apex access
--> API / Named Credential access
--> Agent permissions
Error 5 — Asset Was Updated but Agent Still Uses Old Behaviour
Solution : Add the latest version from the Asset Library again and recreate the required customisations.
8. Best Practices for Subagents :
  1. Keep "one clear job" for each Subagent.
  2. Give the Subagent a "clear name and description".
  3. Write "Clear and specific instructions".
  4. Avoid creating multiple Subagents with "similar responsibilities".
  5. Add only the "required Actions" to each Subagent.
  6. Keep the number of Subagents and Actions "manageable".
  7. Make sure required "permissions and data access" are available.
  8. Use clear routing conditions so the "Agent Router" selects the correct Subagent.
  9. Test each Subagent with "different user questions".
  10. Re-test after changing instructions, Actions, or assets.