Salesforce Agentforce tutorial for beginners
On this page (6 sections)
Lesson 1: How an agent worksLesson 2: Building your first agentLesson 3: Prompt templates and groundingLesson 4: Trust, security and running agentsPractise this topicCommon questionsAgentforce is Salesforce's platform for AI agents that understand requests in plain language and take action in Salesforce, such as answering customers, updating records or preparing sales meetings. Admins and developers build them with familiar tools: Flow, Apex and prompt templates.
In this topic: Lesson 1: How an agent works · Lesson 2: Building your first agent · Lesson 3: Prompt templates and grounding · Lesson 4: Trust, security and running agents
Lesson 1: How an agent works
- A user or customer sends a message in a channel, such as a chat window, Slack or a record page.
- The Atlas Reasoning Engine works out what the user wants and picks the matching subagent (formerly called topics).
- It follows that subagent's instructions and runs the right actions, such as a Flow, Apex method or prompt template.
- The response passes through the Einstein Trust Layer and is returned to the user. If the agent can't help, it hands over to a human.
Lesson 2: Building your first agent
- Turn on Agentforce and Einstein generative AI in Setup (in a Developer Edition or a sandbox with the right licences).
- Open Agentforce Builder and create an agent from a template, such as a service agent.
- Add a subagent with a clear description and short instructions, for example "Order status: help customers check where their order is".
- Add actions: an autolaunched Flow that looks up the order, or an Apex invocable method. Write clear names and descriptions for the action and its inputs.
- Set the agent user's permissions to only what the actions need.
- Test in the preview panel, then in Agentforce Testing Center with many differently worded requests, before activating.
Lesson 3: Prompt templates and grounding
Prompt Builder creates reusable prompt templates, such as Sales Email, Field Generation, Record Summary and Flex templates. Grounding adds real data to the prompt with merge fields, related records, Flow or Apex outputs, or retrievers that search knowledge in Data 360.
You are a helpful service assistant.
Summarise the case below in three bullet points for a support manager.
Case subject: {!$Input:Case.Subject}
Description: {!$Input:Case.Description}
Priority: {!$Input:Case.Priority}Lesson 4: Trust, security and running agents
- The Einstein Trust Layer masks sensitive data, relies on zero data retention with model providers, checks for toxicity and keeps an audit trail.
- Agents only access what their permissions allow: the agent user for service agents, or the logged-in user for employee agents.
- Add guardrails: instructions on what never to do, confirmation before risky actions, and handover rules.
- After launch, review conversations, track resolution and handover rates, and improve instructions, actions and knowledge regularly.
Tip: Start with one narrow, high-volume use case with clean data and a clear success measure. It is also the best story to tell in interviews.
Practise this topic
- Agentforce practice exercises, with model answers
- Agentforce interview questions
- Agentforce Specialist exam concepts
- Agentforce scenarios
- Agentforce mock interview
Common questions
01Do I need to code to build an agent?
Do I need to code to build an agent?
No. Many agents are built with Flow and prompt templates. Apex helps for complex actions, and developers often build those.
02What is the difference between a subagent and an action?
What is the difference between a subagent and an action?
A subagent is a job the agent can do, with a description and instructions. An action is a specific step it can take, such as running a Flow or Apex method.
03Which certification covers Agentforce?
Which certification covers Agentforce?
Salesforce Certified Agentforce Specialist. See our Agentforce certification guide and exam concepts page.