---
schema_version: "1"
id: f026793f24065948a650bdb41a35c8da924e7d67cf797e208a42bf2e2c409df3
title: agent adl create
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/salesforcedx/sfclireference/guides/agent/cli_reference_agent_adl_create.md
canonical_url: https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference_agent_adl_create.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 8deb032aabec479a029fc5f79d8d2c7e8fafbdbcf977bc520ec8315f62d2dbe0
products:
  - Salesforce CLI Command Reference
  - salesforcedx
---
<!-- prettier-ignore-start -->

# agent adl create

Create an Agentforce Data Library.

## Description for agent adl create

Creates a new data library in the target org. The --source-type flag determines the type of library: SFDRIVE (file upload), KNOWLEDGE (Salesforce Knowledge articles), or RETRIEVER (existing active Custom Retriever).

For SFDRIVE libraries, creation provisions the full Data Cloud pipeline (DLO → DMO → SearchIndex → Retriever). Upload files with `sf agent adl upload` after creation.

## Flags

| Flag Name (Long) | Flag Name (Short) | Description |
|------------------|-------------------|-------------|
| <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;content&#8209;fields</code> | N/A | **Type:** Value<br><br>Comma-separated list of content fields for KNOWLEDGE libraries (optional, mutable after creation). |
| <code>&#8209;&#8209;data&#8209;category&#8209;ids</code> | N/A | **Type:** Value<br><br>Comma-separated list of data category selection IDs for KNOWLEDGE libraries. Mutually exclusive with --data-category-names (provide one or the other, not both). |
| <code>&#8209;&#8209;data&#8209;category&#8209;names</code> | N/A | **Type:** Value<br><br>Comma-separated list of data category names in qualified format (e.g., "Group_API_Name.Category"). Mutually exclusive with --data-category-ids (provide one or the other, not both). |
| <code>&#8209;&#8209;description</code> | N/A | **Type:** Value<br><br>Description of the data library (max 255 characters). |
| <code>&#8209;&#8209;developer&#8209;name</code> | N/A | **Type:** Value<br>**Required**<br><br>API name for the data library (max 80 characters, alphanumeric and underscores only, must start with a letter). |
| <code>&#8209;&#8209;flags&#8209;dir</code> | N/A | **Type:** Value<br><br>Import flag values from a directory. |
| <code>&#8209;&#8209;index&#8209;mode</code> | N/A | **Type:** Value<br>**Valid Values:** `basic`, `enhanced`<br><br>Index mode for SFDRIVE libraries: basic or enhanced. |
| <code>&#8209;&#8209;json</code> | N/A | **Type:** Boolean<br><br>Format output as json. |
| <code>&#8209;&#8209;name</code> | <code>&#8209;n</code> | **Type:** Value<br>**Required**<br><br>Display name for the data library (max 80 characters). |
| <code>&#8209;&#8209;primary&#8209;index&#8209;field1</code> | N/A | **Type:** Value<br><br>Primary index field 1 for KNOWLEDGE libraries (required, immutable after creation). |
| <code>&#8209;&#8209;primary&#8209;index&#8209;field2</code> | N/A | **Type:** Value<br><br>Primary index field 2 for KNOWLEDGE libraries (required, immutable after creation). |
| <code>&#8209;&#8209;retriever&#8209;id</code> | N/A | **Type:** Value<br><br>ID of an active Custom Retriever (required for RETRIEVER source type; retriever must be active). |
| <code>&#8209;&#8209;source&#8209;type</code> | N/A | **Type:** Value<br>**Required**<br>**Valid Values:** `sfdrive`, `knowledge`, `retriever`<br><br>Type of grounding source: sfdrive (file upload), knowledge (Salesforce Knowledge articles), or retriever (existing active Custom Retriever). |
| <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;wait</code> | <code>&#8209;w</code> | **Type:** Value<br><br>Wait N minutes for indexing to complete (KNOWLEDGE libraries). SFDRIVE libraries require upload before indexing; RETRIEVER libraries are ready immediately. |

## Examples for agent adl create

Create an SFDRIVE library:

```shell
sf agent adl create --target-org myOrg --name "My Docs" --developer-name My_Docs --source-type sfdrive
```

Create a KNOWLEDGE library with index fields:

```shell
sf agent adl create --target-org myOrg --name "KB Library" --developer-name KB_Library --source-type knowledge --primary-index-field1 Title --primary-index-field2 Summary
```

Create a RETRIEVER library:

```shell
sf agent adl create --target-org myOrg --name "Existing Retriever" --developer-name Existing_Retriever --source-type retriever --retriever-id 0ppXX0000000001
```
<!-- prettier-ignore-end -->
