A collection of easy-to-digest Agent Script examples. Each recipe demonstrates how to build a specific agent behaviour in the fewest lines of script possible while following best practices. From "Hello World" interactions to sophisticated agent transitions, there's a recipe for that!
Important
The new Agentforce Builder is a beta service that is subject to the Beta Services Terms at Agreements - Salesforce.com or your written Unified Pilot Agreement, and applicable terms in the Product Terms Directory. Use of this beta service consumes usage types per the Agentforce and Generative AI Usage and Billing documentation and is at the Customer's sole discretion.
Make sure to review the following prerequisites before installing the app.
Important
This project requires Salesforce CLI with version 2.113.6 or greater.
Install the Salesforce CLI or, check that your installed CLI version is greater than 2.113.6 by running sf -v in a terminal.
If you need to update the Salesforce CLI, either run sf update or npm install --global @salesforce/cli depending on how you installed the CLI.
-
Einstein: Enable Einstein in your org. From Setup, search for Einstein Setup in Quick Find. Click on that entry and turn on the Einstein toggle.
-
Agentforce: Enable Agentforce in your org. From Setup, search for Agentforce in Quick Find. Click on Agentforce Agents, and turn on the Agentforce toggle.
Prompt Template Manager: Assign yourself the Prompt Template Manager permission set. You can either do this from Setup or with the Salesforce CLI by running this command:
sf org assign permset -n EinsteinGPTPromptTemplateManagerIf you don't have an org yet, you can sign up for a free Developer Edition Org.
Important
Make sure to start from a brand-new environment to avoid conflicts with previous work you may have done.
-
Clone this repository:
git clone https://github.com/trailheadapps/agent-script-recipes cd agent-script-recipes -
Authorize your Developer Edition org and provide it with an alias (agent-script-recipes in the command below):
sf org login web -s -a agent-script-recipes
-
Deploy the app to your org:
sf project deploy start -d force-app
-
Assign the
Agent_Script_Recipes_DataandAgent_Script_Recipes_Apppermission sets to the default user:sf org assign permset -n Agent_Script_Recipes_Data sf org assign permset -n Agent_Script_Recipes_App
-
Import some sample data:
sf data import tree --plan data/data-plan.json
-
Open your org with the Agentforce Studio app displayed:
sf org open -p "/lightning/n/standard-AgentforceStudio?c__nav=agents"
Tip
Agentforce Studio can be reached from the App Launcher. From there, click View All then select the Agentforce Studio app.
Post installation: when working with the recipes, assign the Agent Script Recipes Data permission set to your agent user to avoid access issues.
This repository contains several files that are relevant if you want to integrate modern web development tools into your Salesforce development processes or into your continuous integration/continuous deployment processes.
Prettier is a code formatter used to ensure consistent formatting across your code base. To use Prettier with Visual Studio Code, install this extension from the Visual Studio Code Marketplace. The .prettierignore and .prettierrc files are provided as part of this repository to control the behavior of the Prettier formatter.
ESLint is a popular JavaScript linting tool used to identify stylistic errors and erroneous constructs. To use ESLint with Visual Studio Code, install this extension from the Visual Studio Code Marketplace. The .eslintignore file is provided as part of this repository to exclude specific files from the linting process in the context of Lightning Web Components development.
This repository also comes with a package.json file that makes it easy to set up a pre-commit hook that enforces code formatting and linting by running Prettier and ESLint every time you git commit changes.
To set up the formatting and linting pre-commit hook:
- Install Node.js if you haven't already done so
- Run
npm installin your project's root folder to install the ESLint and Prettier modules (Note: Mac users should verify that Xcode command line tools are installed before running this command.)
Prettier and ESLint will now run automatically every time you commit changes. The commit will fail if linting errors are detected. You can also run the formatting and linting from the command line using the following commands (check out package.json for the full list):
npm run lint
npm run prettier