Sub topic 10
Activating the agent and checking it works
This chapter assumes you have deployed the agent metadata to the target org and can use Salesforce CLI. You should also know what permission sets and the agent user are. After a deployment, the agent is not live. You must grant access, activate it, and confirm it behaves as it did in the source org.
Why deployment does not make the agent live
Deploying Bot, BotVersion, GenAiPlanner, GenAiPlugin and GenAiFunction creates the agent definition in the target org. The deployed version usually arrives inactive. Activation is a separate step, and it is the point where the platform checks that the agent can run.
The order matters:
- Confirm the deployment succeeded.
- Assign the permission sets that grant access to the agent's actions.
- Activate the agent.
- Run checks against the live agent.
Assign permissions, then activate
Actions in your agent call Apex classes and Flows. The users and the agent user need access to them in the target org. Assign the permission set first, so activation does not fail on missing access.
sf org assign permset --name Agent_Action_Access --target-org target-org
sf agent activate --api-name My_Service_Agent --target-org target-orgAgent_Action_Access and My_Service_Agent are placeholders. Use your own permission set name and the agent's API name. The API name is the Bot developer name, which matches the file name under bots/ in your project.
You can also activate from Setup. Open Agentforce Agents, select the agent, and choose Activate. The CLI is easier to repeat and to script later.
Check that the agent is active
After activation, confirm the state before you test behavior. In Setup, the agent should show as Active. In the project, you can retrieve the BotVersion from the target org and read its status.
sf project retrieve start \
--metadata BotVersion \
--target-org target-orgOpen the retrieved BotVersion file and look for the status field. It should read Active. If it reads Inactive, the activation did not complete.
Check behavior, not only status
An active agent can still behave differently from the source. Compare these items against the source org:
| Check | What to look for |
|---|---|
| Topics | Same topics appear, with the same descriptions and instructions |
| Actions | Each topic lists its actions, and none are missing |
| Agent user | The agent runs as the expected user in the target org |
| Data | Actions return results, since record data differs between orgs |
| Channel | The agent is reachable through the intended channel |
Data is the most common cause of a difference. A Flow that looks up an Account by name returns nothing if the target sandbox does not contain that Account. The metadata is correct, but the answer is not.
Try a few test utterances
Open the agent in the Agent Builder in the target org and use the conversation preview. Send one message for each topic, plus one message that should fall outside all topics. For each message, check three things:
- The agent picks the topic you expect.
- The agent calls the expected action.
- The reply uses real data from the target org.
Keep this list of messages. The next chapter builds on it for structured testing.
Common activation problems
- Activation fails with a missing dependency. An Apex class, Flow, or other component that an action uses is absent or inactive in the target. Deploy it, activate the Flow if needed, and activate again.
- The agent activates but actions fail. The agent user lacks access. Check the permission set assignment.
- The agent answers but ignores a topic. Compare the
GenAiPlugincontent with the source. A partial deployment can leave a topic out.
Exercise
You deployed an agent and assigned the permission set. Activation succeeds and the status reads Active, but a test message returns an empty answer from an action that looks up an Account. Metadata matches the source org. What is the most likely cause, and how do you confirm it?
Show answer
The target org probably does not contain the Account data the action looks up. Confirm by searching for that Account in the target org, or by running the Flow with a known record. The metadata is fine, so no redeployment is needed. Add or create the test data in the target org and repeat the message.
Exercise
List the steps after a successful deployment, in order, and give the CLI command for the activation step.
Show answer
Assign the permission sets, activate the agent, then verify behavior. The activation command is sf agent activate --api-name My_Service_Agent --target-org target-org, with your own agent API name.