---
schema_version: "1"
id: 7186639e6378bbd3fdcdebf2f573d09ce0337174eef013607207fbb662aaae59
title: agent generate agent-spec
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/salesforcedx/sfclireference/guides/agent/cli_reference_agent_generate_agent-spec.md
canonical_url: https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference_agent_generate_agent-spec.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 55131effa44bfed8382f19b1aef122e5fe6b6d193d254111f889646443ae00e9
products:
  - Salesforce CLI Command Reference
  - salesforcedx
---
<!-- prettier-ignore-start -->

# agent generate agent-spec

Generate an agent spec, which is a YAML file that captures what an agent can do.

## Description for agent generate agent-spec

An agent spec is a YAML-formatted file that contains basic information about the agent, such as its role, company description, and an AI-generated list of topics based on this information. Topics define the range of jobs your agent can handle.

Use flags, such as --role and --company-description, to provide details about your company and the role that the agent plays in your company. If you prefer, you can also be prompted for the basic information; use --full-interview to be prompted for all required and optional properties. Upon command execution, the large language model (LLM) associated with your org uses the provided information to generate a list of topics for the agent. Because the LLM uses the company and role information to generate the topics, we recommend that you provide accurate, complete, and specific details so the LLM generates the best and most relevant topics. Once generated, you can edit the spec file; for example, you can remove topics that don't apply or change a topic's description.

You can also iterate the spec generation process by using the --spec flag to pass an existing agent spec file to this command, and then using the --role, --company-description, etc, flags to refine your agent properties. Iteratively improving the description of your agent allows the LLM to generate progressively better topics.

You can also specify other agent properties, such as a custom prompt template, how to ground the prompt template to add context to the agent's prompts, the tone of the prompts, and the username of a user in the org to assign to the agent.

When your agent spec is ready, generate an authoring bundle from it by passing the spec file to the --spec flag of the "agent generate authoring-bundle" CLI command. An authoring bundle is a metadata type that contains an Agent Script file, which is the blueprint for an agent. (While not recommended, you can also use the agent spec file to immediately create an agent with the "agent create" command. We don't recommend this workflow because these types of agents don't use Agent Script, and are thus less flexible and more difficult to maintain.)

## Flags

| Flag Name (Long) | Flag Name (Short) | Description |
|------------------|-------------------|-------------|
| <code>&#8209;&#8209;agent&#8209;user</code> | N/A | **Type:** Value<br><br>Username of a user in your org to assign to your agent; determines what your agent can access and do. |
| <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;company&#8209;description</code> | N/A | **Type:** Value<br><br>Description of your company. |
| <code>&#8209;&#8209;company&#8209;name</code> | N/A | **Type:** Value<br><br>Name of your company. |
| <code>&#8209;&#8209;company&#8209;website</code> | N/A | **Type:** Value<br><br>Website URL of your company. |
| <code>&#8209;&#8209;enrich&#8209;logs</code> | N/A | **Type:** Value<br>**Valid Values:** `true`, `false`<br><br>Adds agent conversation data to event logs so you can view all agent session activity in one place. |
| <code>&#8209;&#8209;flags&#8209;dir</code> | N/A | **Type:** Value<br><br>Import flag values from a directory. |
| <code>&#8209;&#8209;force&#8209;overwrite</code> | N/A | **Type:** Boolean<br><br>Don't prompt the user to confirm that an existing spec file will be overwritten. |
| <code>&#8209;&#8209;full&#8209;interview</code> | N/A | **Type:** Boolean<br><br>Prompt for both required and optional flags. |
| <code>&#8209;&#8209;grounding&#8209;context</code> | N/A | **Type:** Value<br><br>Context information and personalization that's added to your prompts when using a custom prompt template. |
| <code>&#8209;&#8209;json</code> | N/A | **Type:** Boolean<br><br>Format output as json. |
| <code>&#8209;&#8209;max&#8209;topics</code> | N/A | **Type:** Value<br><br>Maximum number of topics to generate in the agent spec; default is 5. |
| <code>&#8209;&#8209;output&#8209;file</code> | N/A | **Type:** Value<br>**Default value:** `specs/agentSpec.yaml`<br><br>Path for the generated YAML agent spec file; can be an absolute or relative path. |
| <code>&#8209;&#8209;prompt&#8209;template</code> | N/A | **Type:** Value<br><br>API name of a customized prompt template to use instead of the default prompt template. |
| <code>&#8209;&#8209;role</code> | N/A | **Type:** Value<br><br>Role of the agent. |
| <code>&#8209;&#8209;spec</code> | N/A | **Type:** Value<br><br>Agent spec file, in YAML format, to use as input to the command. |
| <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;tone</code> | N/A | **Type:** Value<br>**Valid Values:** `formal`, `casual`, `neutral`<br><br>Conversational style of the agent, such as how it expresses your brand personality in its messages through word choice, punctuation, and sentence structure. |
| <code>&#8209;&#8209;type</code> | N/A | **Type:** Value<br>**Valid Values:** `customer`, `internal`<br><br>Type of agent to create. Internal types are copilots used internally by your company and customer types are the agents you create for your customers. |

## Examples for agent generate agent-spec

Generate an agent spec in the default location and use flags to specify the agent properties, such as its role and your company details; use your default org:

```shell
sf agent generate agent-spec --type customer --role "Field customer complaints and manage employee schedules." --company-name "Coral Cloud Resorts" --company-description "Provide customers with exceptional destination activities, unforgettable experiences, and reservation services."
```

Generate an agent spec by being prompted for the required agent properties and generate a maxiumum of 5 topics; write the generated file to the "specs/resortManagerSpec.yaml" file and use the org with alias "my-org":

```shell
sf agent generate agent-spec --max-topics 5 --output-file specs/resortManagerAgent.yaml --target-org my-org
```

Be prompted for all required and optional agent properties; use your default org:

```shell
sf agent generate agent-spec --full-interview
```

Specify an existing agent spec file called "specs/resortManagerAgent.yaml", and then overwrite it with a new version that contains newly AI-generated topics based on the updated role information passed in with the --role flag:

```shell
sf agent generate agent-spec --spec specs/resortManagerAgent.yaml --output-file specs/resortManagerAgent.yaml --role "Field customer complaints, manage employee schedules, and ensure all resort operations are running smoothly"
```

Specify that the conversational tone of the agent is formal and to attach the "resortmanager@myorg.com" username to it; be prompted for the required properties and use your default org:

```shell
sf agent generate agent-spec --tone formal --agent-user resortmanager@myorg.com
```
<!-- prettier-ignore-end -->
