Activate an agent in an org.
Description for agent activate
Activating an agent makes it immediately available to your users. A published agent must be active before you can preview it with the "agent preview" CLI command or VS Code. Agents can have multiple versions; only one version can be active at a time.
If you run the command without the --api-name or --version flags, the command provides a list of agent API names and versions for you to choose from. Use the flags to specify the exact agent and version without being prompted. If you use the --json flag and not --version, then the latest agent version is automatically activated.
The value of the --version flag is always a number, corresponding to the "vX" part of the "BotVersion" metadata in your project. For example, if you have a force-app/main/default/bots/My_Agent/v4.botVersion-meta.xml file in your project, then you activate this version with the "--version 4" flag.
Flags
| Flag Name (Long) | Flag Name (Short) | Description |
|---|---|---|
| <code>‑‑api‑name</code> | <code>‑n</code> | Type: Value<br><br>API name of the agent to activate; if not specified, the command provides a list that you choose from. |
| <code>‑‑api‑version</code> | N/A | Type: Value<br><br>Override the api version used for api requests made by this command |
| <code>‑‑flags‑dir</code> | N/A | Type: Value<br><br>Import flag values from a directory. |
| <code>‑‑json</code> | N/A | Type: Boolean<br><br>Format output as json. |
| <code>‑‑target‑org</code> | <code>‑o</code> | Type: Value<br>Required<br><br>Username or alias of the target org. Not required if the target-org configuration variable is already set. |
| <code>‑‑version</code> | N/A | Type: Value<br><br>Version number of the agent to activate; if not specified, the command provides a list that you choose from. |
Examples for agent activate
Activate an agent in your default target org by being prompted for both its API name and version:
sf agent activate
Activate version 2 of an agent with API name Resort_Manager in the org with alias "my-org":
sf agent activate --api-name Resort_Manager --version 2 --target-org my-org
<!-- prettier-ignore-end -->