Sub topic 7
Creating your first agent in Agentforce Builder
This chapter walks through creating a first agent in Agentforce Builder in a Developer Edition org. It assumes you have already signed up for a Developer Edition org with Agentforce, turned on Agentforce and generative AI in Setup, and assigned yourself the permission sets needed to build agents. You should also know the basics of Lightning Experience, Setup, objects, and records.
Topics, instructions, and actions get their own chapters. Here the goal is narrower: create the agent record, understand what each field does, and get a minimal agent saved and ready for the next steps.
What Agentforce Builder is
Agentforce Builder is the Setup tool for defining an agent. An agent is a configured assistant that reads a user's message, chooses a topic, and then follows that topic's instructions and calls its actions. The builder holds the agent's identity, its topics, its actions, and a conversation preview panel you use for testing.
You will work with these parts:
- Agent details: name, API name, description, role, and company.
- Agent type: decides who talks to the agent and what it is meant for.
- Topics: the jobs the agent can do. Each topic has a scope and instructions.
- Actions: the things the agent can run, such as a standard action, an Apex method, a flow, or a prompt template.
- Preview panel: a chat window where you try the agent before you activate it.
The flow below shows the path from an empty org to an agent you can test.
Before you start
Check these items first. Most failures in this chapter come from one of them.
- You are logged in to the Developer Edition org, not a sandbox or a trial org that lacks Agentforce.
- In Setup, Agentforce Agents appears in Quick Find, and the Agentforce and generative AI toggles are on.
- Your user has the permission sets for building agents. A user without them either does not see the menu item or sees the builder in a read-only state.
- Data Cloud provisioning has finished. If it is still pending, some builder features load slowly or show errors.
If the menu item is missing, go back to the chapters on enabling Agentforce and assigning permission sets. Creating the agent will not work until those are fixed.
Exact menu names and screens change between Salesforce releases. If your screen differs from the descriptions here, trust the field purposes described in this chapter over the exact labels.
Create the agent
- From Setup, enter
Agentforce Agentsin Quick Find and open it. - Click New Agent.
- Choose an agent type. For a first agent in a Developer Edition org, pick the Agentforce Service Agent or Agentforce Employee Agent type, whichever your org offers. The two types differ in who uses them:
- A service agent talks to customers, usually on a messaging channel.
- An employee agent helps internal users and runs inside Salesforce.
- Fill in the agent details described in the next section.
- Review the topics and actions the builder proposes, then save.
Use the employee type if you are unsure. It does not need a messaging channel or a service-agent user to test, and that keeps the first build simple. Service agents need extra setup before they can be activated, which a later chapter covers.
Agent details explained
Each field shapes how the agent introduces itself and how the language model frames its answers.
| Field | Purpose | Example |
|---|---|---|
| Name | The label shown in lists and the builder | Case Helper |
| API name | A unique identifier, fixed after creation in most cases | Case_Helper |
| Description | A plain statement of what the agent is for | Answers questions about customer support cases |
| Role | The part the agent plays, written for the model | You help support staff check the status of cases. |
| Company | Who the agent represents, used in tone and context | Acme Support |
The role and description are not decoration. The model sees them as part of its prompt, so a vague role produces vague behavior. Write the role in the second person and state what the agent should do. Keep it short and concrete.
Weak role text:
You are a helpful assistant.Better role text:
You help support staff check the status of customer cases. You answer in short, factual sentences and never invent case data.Naming and the API name
The API name must be unique in the org and uses letters, numbers, and underscores. Treat it as permanent. Deployment tooling, tests, and metadata references use it, so changing it later can break them. Pick a name that you would be comfortable seeing in source control.
What the builder gives you by default
When you save, the builder may add default topics and actions based on the agent type. These vary by type and release. Common ones are a general topic for off-topic questions and an escalation topic that hands off to a person.
Look at each default before moving on:
- Read its scope. A topic whose scope is too broad will take questions that belong to your own topics.
- Check which actions it has. A default action you do not need adds noise and gives the model more choices to get wrong.
- Remove or disable anything you cannot explain.
A smaller agent is easier to test. Start with one topic you wrote yourself and add more only when that one works.
How the agent decides what to do
Understanding the runtime model helps you make sense of the preview results later. For each user message, the agent roughly does this:
- It reads the message and the conversation so far.
- It compares the message to the descriptions and scopes of all topics and picks one.
- Inside that topic, it reads the instructions and decides whether to answer directly or call an action.
- If it calls an action, it passes inputs, receives outputs, and writes a reply based on them.
The key point is that topic selection depends on the text you write. Topic names, descriptions, and scopes are the only signals the model has at that step. This is why the next chapter spends so much time on wording.
Ask for a first sanity check
You have not yet written your own topic, but you can confirm the agent saves and responds. Open the preview panel and send a message such as:
Hello, what can you help me with?Check three things:
- The agent replies, which proves the model connection and permissions work.
- The reply matches the role you wrote, for example in tone and length.
- The reply does not claim abilities you did not configure.
If the preview shows an error or never responds, the most common causes are a missing permission set, generative AI not enabled, or Data Cloud still provisioning. Check them in that order.
Optional: deploying and retrieving the agent with the CLI
If you installed the Salesforce CLI, you can log in to the org and move source between it and your computer. This is not required for the first agent, but it becomes useful once you add the Apex action in a later chapter.
sf org login web --alias agentforce-dev
sf project deploy start --source-dir force-app --target-org agentforce-devThe first command opens a browser window and stores a login under the alias agentforce-dev. The second deploys everything under force-app to that org. Run both from the root of a Salesforce DX project.
Common errors when creating the first agent
| Symptom | Likely cause | Fix |
|---|---|---|
| No Agentforce Agents entry in Setup | Agentforce not enabled, or the org is not a Developer Edition org with Agentforce | Confirm the org type, then enable Agentforce and generative AI |
| New Agent button is missing or disabled | Missing permission set | Assign the builder permission sets and refresh |
| Save fails on API name | Name already used or contains invalid characters | Use letters, numbers, and underscores, and start with a letter |
| Preview never answers | Generative AI off, or Data Cloud still provisioning | Check the toggles and the provisioning status |
| Agent replies in an unexpected style | Role text is vague or missing | Rewrite the role with concrete behavior |
| Agent answers things it should refuse | Scope of a default topic is too wide | Narrow or remove that topic |
Good habits from the start
- Write the agent's description before building, so you can tell whether a feature belongs in it.
- Change one thing at a time and re-test in the preview. If two changes land together, you cannot tell which one caused a result.
- Keep a short list of test messages, including ones that should be refused. You will reuse it in the testing chapter.
- Treat the saved agent as a draft. You are not required to activate it yet, and an inactive agent cannot be reached from any channel.
Summary of what you have now
At this point you have an agent with a name, a role, and a description, created from the type that fits your plan. You have reviewed its default topics and actions and confirmed that it answers in the preview. It has no custom topic, no custom action, and it is not active. The next chapter adds a topic with a precise scope and numbered instructions, which is where the agent starts to behave in a way that is specific to your use case.
Exercise
You created an agent and the preview panel gives an answer that claims it can look up the status of billing invoices, which you never configured. Name two places to look for the cause, and say what you would change first.
Show answer
Check the role and description text, since a vague or over-promising role can lead the model to claim abilities, and check the scope of the default topics, since a broad scope can accept questions that belong elsewhere. Change the role first. Rewrite it to state what the agent does and add a line that it must not invent data or abilities, then retest in the preview. Narrow or remove a default topic only if the problem remains.
Exercise
Why is the API name of an agent worth choosing carefully, and what characters can it use?
Show answer
The API name is a unique identifier that metadata, deployment tooling, and tests refer to, so changing it later can break those references. It uses letters, numbers, and underscores, and should start with a letter.
Exercise
You want a first agent that you can test without setting up a messaging channel. Which agent type is the simpler choice, and why?
Show answer
The employee agent type. It runs inside Salesforce for internal users, so it does not need a messaging channel or a service-agent user to be tested. Service agents need extra setup before activation.