We can enable and create an Agentforce org using our Trailhead account, and as our agent expired, we had to create another org using the Trailhead account. But now, with the Spring ’25 release, we can create an agent org using our normal Salesforce developer org by creating scratch orgs.
In this tutorial, we will learn about scratch orgs in Salesforce and how to create Agentforce-enabled scratch orgs from Salesforce Developer Edition. So, with the scratch orgs, it will be very helpful to use an agent-enabled org in Salesforce.
Scratch Org in Salesforce
A Scratch Org in Salesforce is a temporary Salesforce environment used for development and testing. It is a new playground where we can test new features, write code, or configure settings before deploying changes to production without affecting our main Salesforce org. It is mainly used in Salesforce DX (Developer Experience).
It will be available for a limited time (maximum 30 days), and we can create multiple scratch orgs, test different things, and then delete them when we’re done.
The scratch org can be created using the production org as well as the developer org. So if we have a normal developer org, we can create a scratch org from that, and in that scratch org, we can specify the feature that will ensure the agent force is enabled in our org.
Create Agentforce-Enabled Scratch Orgs From Salesforce Developer Edition
In the steps below, I will explain the prerequisites and how to create Agentforce-enabled scratch orgs from the Salesforce developer edition.
To understand the prerequisites, you can visit the Agentforce Developer Guide. There, we have details on what we need to create a scratch org in Salesforce.
Firstly, we need a CLI, so make sure that you have Salesforce CLI installed and that you have authorisation to the dev hub in your system. I will explain all of this in the steps below.
Scratch or Definition File
After that, below, I have given the most important file, the scratch or definition file, and here you will see that it has Einstein’s one API platform feature added. So with this feature, the scratch that we are going to create will have Agentforce enabled.
Also, we have an Einstein GPT setting, so here we are enabling the Einstein GPT Platform. This is the same step that we used to take from the Einstein Setup, where we used to turn on the Einstein Copilot.
{
"orgName": "Agentforce scratch org",
"edition": "Developer",
"features": ["EnableSetPasswordInApi","Einstein1AIPlatform"],
"settings": {
"lightningExperienceSettings": {
"enableS1DesktopEnabled": true
},
"mobileSettings": {
"enableS1EncryptedStoragePref2": false
},
"einsteinGptSettings" : {
"enableEinsteinGptPlatform" : true
}
}
}
Now open the IDE you have. I have installed VS Code. If you create an SFDX project, you will have a config folder within it, and you will also have the project scratch definition. JSON file. Now you need to copy the above scratch or definition file and paste it into the scratch definition JSON file, which is inside the Config.
