Sub topic 1
What Agentforce is and how agents are structured
Agentforce is Salesforce's platform for building AI agents that work inside your org. An agent reads a request in natural language, decides what to do, and carries out the work by calling things you have already built, such as Flows and Apex. This chapter introduces the parts every agent shares. Later chapters cover each part in detail.
Prerequisites
This chapter assumes you have:
- Basic Salesforce concepts: objects, records, and permission sets.
- Beginner-level familiarity with Flow or Apex.
- A general idea of what a large language model (LLM) does.
The building blocks of an agent
Every Agentforce agent is assembled from the same few pieces.
- Topic: A unit of work the agent can handle, such as "Order Status". A topic has a short classification description, a scope, and instructions.
- Instructions: Natural-language rules inside a topic. They tell the agent what to do, in what order, and what to avoid.
- Action: A capability the agent can run, such as a Flow, an Apex invocable method, or a prompt template. Actions read or change data.
- Reasoning engine: The LLM-driven component that reads the request, picks a topic, and chooses which actions to call.
- Agent user and permissions: The identity the agent runs as, which limits the data it can reach.
You write topics, instructions, and actions. The platform supplies the reasoning engine.
How a request flows through an agent
When a user sends a message, the reasoning engine compares it with the classification description of each topic and selects the best match. It then reads that topic's instructions and decides which action to call, if any. The action runs, returns data, and the engine writes a reply from that result. If the request needs more steps, the engine repeats the process.
The loop back to the reasoning engine matters. The engine can call several actions in one conversation turn before it answers.
A topic in practice
A topic is plain text, not code. This one handles order status:
Topic: Order Status
Classification description: Customer asks where an order is or what state it is in.
Scope: Look up the status of a single order using the Get Order Status action.
Instructions:
- Ask for the order number if the customer has not given one.
- Call the Get Order Status action with that order number.
- Report only the status returned by the action.
- Do not discuss refunds or cancellations in this topic.The classification description helps the engine choose this topic. The scope and instructions keep the agent from drifting into other work. The last instruction sets a boundary, and boundaries are as important as capabilities.
Two agent types, one structure
Agentforce offers two main agent types. A service agent talks to customers, usually on public channels. An employee agent helps internal users and runs as the person asking. Both use topics, instructions, and actions. They differ in audience, identity, channels, and access, which later chapters explain.
Common errors
- Vague classification descriptions. If two topics sound alike, the engine may pick the wrong one. Write descriptions that are distinct.
- Instructions that conflict with scope. An instruction that asks for work outside the topic's scope confuses the engine.
- Assuming the agent can reach all data. An agent only sees what its identity and permissions allow.
Exercise
A customer asks about a refund, but the agent answers with order status information. Which two parts of the topic setup would you check first?
Show answer
Check the classification descriptions of the topics, because the engine may be matching the message to the wrong topic, and check the instructions and scope of the Order Status topic, which should exclude refunds and keep the agent from handling them.