Manage an Agent with Agentforce DX
You can activate or deactivate an agent right from VS Code or with a CLI command. For more complicated agent management, you can easily open the agent in the Agentforce Builder UI and manage it from there.
Activating an agent makes it immediately available to your users. To make changes to an agent, such as adding or removing topics or actions, deactivate it. Some of the Agentforce DX features, such as the agent preview
CLI command or VS Code Agent Preview panel, require active agents.
-
In VS Code, open your Salesforce DX project.
-
In Explorer, navigate in your package directory to one of the metadata component files that makes up your agent:
- Bot (file extension
.bot-meta.xml
in thebots
directory) - BotVersion (file extension
.botVersion-meta.xml
in thebots
directory) - GenAiPlannerBundle (file extension
.genAiPlannerBundle
in thegenAiPlannerBundles
directory)
- Bot (file extension
-
Right-click the metadata component file and select SFDX: Activate Agent or SFDX: Deactivate Agent.
-
Open a terminal (macOS, Linux) or command prompt (Windows). Or use the integrated terminal in VS Code.
-
Run the
agent activate
command to activate an agent in your org; specify the--target-org
flag if you haven't set the org as your default. For example:The command displays the agents that are currently inactive. Use the arrow keys to select the agent you want to activate, then press Return. If you know the API name of your agent, you can use the
--api-name
flag to immediately activate it without being prompted. -
Run the
agent deactivate
command in a similar way to deactivate active agents.
Sometimes you want to see an agent in the org's Agentforce Builder UI so you can use an in-org feature. It's easy to open your agent in a browser directly in the Agentforce Builder UI from either VS Code or with a CLI command.
-
In VS Code, open your Salesforce DX project.
-
In Explorer, navigate in your package directory to one of the metadata component files that makes up your agent:
- Bot (file extension
.bot-meta.xml
in thebots
directory) - BotVersion (file extension
.botVersion-meta.xml
in thebots
directory) - GenAiPlannerBundle (file extension
.genAiPlannerBundle
in thegenAiPlannerBundles
directory)
- Bot (file extension
-
Right-click the metadata component file and select SFDX: Open an Agent in the Default Org. See Activate or Deactivate and Agent for a screenshot.
The Agentforce Builder UI opens for your agent.
You must know the API name of your agent before you can open it in Agentforce Builder with a CLI command.
-
If necessary, find your agent's API name in its Agent Details page of your org's Agentforce Studio UI in Setup.
-
Open a terminal (macOS, Linux) or command prompt (Windows). Or use the integrated terminal in VS Code.
-
Run the
org open agent
command, specifying the required--api-name
flag. Also specify--target-org
if you haven't set your org as a default. For example:Use the
--private
flag to open your agent in incognito mode. The agent uses your default browser, but you can change that with the--browser
flag.