Create an Agent from an Agent Spec File

After you have an agent spec file that you like, it’s time to create the agent in your development org, such as your sandbox. Let’s say you want to create an agent with the name (label) Resort Manager and you previously generated its agent spec file using its default filename (specs/agentSpec.yaml).

Before actually updating your development org, let’s first preview what the agent will look like when created in the org. From VS Code’s integrated terminal, run this command:

If you’ve set a default org in your DX project, such as your sandbox, you don’t need to specify --target-org. You can also run this command from your DX project using a terminal (macOS, Linux) or command prompt (Windows).

The command prompts you for the API name of the agent; we recommend you accept the default.

The command generates a JSON file with name Resort_Manager_Preview_<timestamp>.json. The JSON file describes the agent that the LLM will create, including suggested actions for each topic, instructions, and sample utterances.

If it all looks good to you, it’s time to create the agent in your org.

From VS Code’s integrated terminal, run the same command you ran to preview the agent creation, but this time remove the --preview flag:

As before, the command prompts you for the new agent’s API name (in this case Resort_Manager); we recommend you accept the default.

The command then displays the steps that it performs, such as parsing the agent spec file, creating the agent in the development org, and retrieving the metadata that was created in the org back to the local DX project. Here’s partial sample output from the command:

Your development org has now been updated with the Resort Manager agent and your local DX project has been synchronized with all its associated metadata. Run this CLI command to open the new agent in your org’s Agent Builder UI:

The --name flag of org open agent uses the API name of an agent; to find an agent's API name, go to Setup in your org and navigate to the agent's details page.

Now that you’ve created a basic agent, it’s time to customize it and implement the details of what it can do.