Skip to main content

Bot components deleted alongside an Agent Script

A description of the Bot components deleted alongside an Agent Script problem analyzer

Written by Josh Camilleri

This problem analyzer stops your deployment failing when you delete an Agent Script that Salesforce has already generated other metadata from.

What triggers this problem analyzer?

When you commit an Agent Script (AiAuthoringBundle) in Agentforce Builder, Salesforce generates the metadata the agent needs to run: an Einstein bot (Bot), a bot version (BotVersion), and a planner bundle (GenAiPlannerBundle). For how those pieces fit together, see How to Deploy Agent Script (AiAuthoringBundle) metadata.

This problem analyzer triggers when your deployment deletes an Agent Script from the target org and also deletes at least one piece of the metadata Salesforce generated from it. Gearset flags it with this message:

Deleting a Bot, BotVersion, or GenAiPlannerBundle alongside the Agent Script that owns them causes the deployment to fail. Salesforce automatically removes them when the Agent Script is deleted.

For example, a deployment that deletes the Agent Script Support_Agent along with its bot Support_Agent, its bot version Support_Agent.v1, and its planner bundle Support_Agent_Planner triggers the analyzer. Gearset counts the affected scripts under Agent scripts affected.

If your deployment deletes the Agent Script on its own, the analyzer doesn't trigger, because there's nothing to leave out. The analyzer runs when your deployment target is a Salesforce org. It doesn't run when the target is a Git repository.

What problem is it solving?

Salesforce removes the autogenerated Bot, BotVersion, and GenAiPlannerBundle itself when the Agent Script goes. A deployment that asks Salesforce to delete those components as well fails.

How does it work?

Gearset excludes the autogenerated metadata from the deployment, so the target org receives the Agent Script deletion on its own and Salesforce clears up the rest. The fix is selected by default, and the problem is flagged as critical. Gearset describes the fix like this:

Exclude the related Bot, BotVersion, and GenAiPlannerBundle deletions from the deployment. Salesforce will clean them up automatically when the Agent Script is deleted.

If only some of the autogenerated metadata is in your deployment, Gearset excludes only those pieces and leaves the rest of the deployment alone. Nothing is removed from your org by Gearset: Salesforce deletes the autogenerated metadata as part of deleting the Agent Script.

Did this answer your question?