---
schema_version: "1"
id: 243264d1042443caedeae3299279ef05eb1e004bfc1b6e6ad1d695ee0c585726
title: agent activate
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/salesforcedx/sfclireference/guides/agent/cli_reference_agent_activate.md
canonical_url: https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference_agent_activate.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 5fa88ba9ddce07e1c71582ff5f6cf28593eeff0540db4647e0ce07508fedb022
products:
  - Salesforce CLI Command Reference
  - salesforcedx
---
<!-- prettier-ignore-start -->

# agent activate

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>&#8209;&#8209;api&#8209;name</code> | <code>&#8209;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>&#8209;&#8209;api&#8209;version</code> | N/A | **Type:** Value<br><br>Override the api version used for api requests made by this command |
| <code>&#8209;&#8209;flags&#8209;dir</code> | N/A | **Type:** Value<br><br>Import flag values from a directory. |
| <code>&#8209;&#8209;json</code> | N/A | **Type:** Boolean<br><br>Format output as json. |
| <code>&#8209;&#8209;target&#8209;org</code> | <code>&#8209;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>&#8209;&#8209;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:

```shell
sf agent activate
```

Activate version 2 of an agent with API name Resort_Manager in the org with alias "my-org":

```shell
sf agent activate --api-name Resort_Manager --version 2 --target-org my-org
```
<!-- prettier-ignore-end -->
