Skip to main content

Use the Bailian CLI

Install and authenticate the Bailian CLI, then use its 36 Knowledge commands for knowledge bases, documents, chunks, and retrieval/Q&A services.

The Bailian CLI (package bailian-cli, commands bl / bailian) uses bl knowledge to manage knowledge bases and call retrieval and Q&A services. This page covers only Knowledge capabilities. Command details follow the source reference's bl 2.8.0 baseline, with the 2.5.0 migration note retained.
This page and the Knowledge Studio CLI (kscli) manual document two different tools. The latter installs from knowledge-studio-cli and uses commands such as kscli kb. Do not simply replace command prefixes or apply this page's flags, confirmation rules, output behavior, or version changes to kscli. Knowledge capabilities in the Bailian CLI are currently available only to China site (aliyun.com) accounts.

Installation, authentication, and workspace

Install

The npm method requires Node.js ≥ 18.17.0 and npm. Do not use pnpm / yarn to install bailian-cli:
npm install -g bailian-cli
bl --version
Without Node.js, use the binary installer instead. For macOS / Linux:
curl -fsSL https://bailian.aliyun.com/cli/install.sh | bash
For Windows PowerShell:
irm https://bailian.aliyun.com/cli/install.ps1 | iex
Both bl and bailian should be on PATH after installation. If the command is not found, run npm config get prefix and check its bin directory for npm installs, or check the path printed by the binary installer. Run bl update to check for and install updates.

Sign in and select an API Key

Knowledge calls use a standard DashScope API Key (Bearer token). Coding Plan Keys in the sk-sp-xxx format do not support knowledge-base services. Do not substitute a subscription model-call profile for Knowledge credentials. For local use, console login is recommended. It defaults to the China site and creates a standard API Key when needed:
bl auth login --console
If a browser cannot open automatically, use bl auth login --console --no-browser to print the login URL. Alternatively, obtain a standard Key from the Bailian console API Key page and sign in. The command tests the Key before saving it:
bl auth login --api-key <YOUR_API_KEY>
bl auth status --output json
For CI and other non-interactive environments, inject DASHSCOPE_API_KEY through secret management instead of saving the Key in a configuration file or script. With multiple profiles, inspect and select the intended one rather than assuming the active Key is a standard Key:
bl config list --output json
bl config use --name <profile>
bl config show --output json
bl auth status --output json
bl config show reports the effective sources of the API Key and Base URL and warns when they come from different configuration sources. Confirm the active credential from masked status output; do not infer Bailian CLI credential precedence from kscli or another Skill's documentation. Use bl auth logout to clear local credentials.
Never put real Keys in repositories, logs, or public chat records. Report authentication status using masked fields only. Login already tests usability; there is no need to make another model call just to verify authentication.

Set the workspace

Knowledge resources belong to a workspace. After console login, list workspaces and configure the target ID:
bl workspace list --list 5
bl config set --key workspace_id --value ws-xxx
bl knowledge list --workspace-id ws-xxx
Knowledge commands accept --workspace-id <id> for the workspace in the API endpoint URL. You can also use the BAILIAN_WORKSPACE_ID environment variable or the workspace_id config key. Examples below that omit the workspace assume it is configured. bl workspace list is a console capability: having a standard API Key is not the same as completing console login.

Shared conventions and safety

  • Append --help to any command for full parameters, for example bl knowledge search --help.
  • The default output is text. --output json returns complete business results on stdout and writes warnings, diagnostics, and errors separately to stderr as JSONL. You can also select JSON with DASHSCOPE_OUTPUT=json or the output config key.
  • --quiet (or DASHSCOPE_QUIET=1) hides only progress and informational messages. It preserves complete results, the final answer, warnings, and errors; it does not mean “ID/answer only.” Scripts should read JSON fields.
  • High-risk deletion, service deployment, and initialization or sync replacement/deletion that require confirmation are blocked with exit code 7 unless --yes is explicitly supplied. They do not wait for interactive input and then continue. Preview with --dry-run before confirming the scope.
  • Dry-run is not an offline mode: knowledge init --dry-run still requires credentials and reads existing resources, but does not change resources or checkpoints.
Knowledge bases incur running-time charges from creation, even without queries. The one-time 720-hour Standard Edition allowance is for new accounts, shared across knowledge bases, and valid for 30 days after activation. Model calls are billed separately. Exiting the CLI or deleting documents does not stop knowledge-base running-time charges. Do not assume free allowance remains; check the scope before deleting unused knowledge bases. See Billing.

All 36 Knowledge commands

This list counts only bl knowledge commands, not installation, authentication, or configuration commands. The Bailian CLI creation command is bl knowledge create, not bl knowledge kb create. IDs, file paths, and image URLs in examples are placeholders: replace them with your own resources and prepare JSON files in the format required by each flag.
CommandPurpose
bl knowledge searchCall a retrieval service
bl knowledge chatCall a Q&A service
bl knowledge initInitialize and verify sample retrieval
bl knowledge createCreate a knowledge base and import files/categories
bl knowledge listList knowledge bases
bl knowledge infoInspect knowledge-base configuration
bl knowledge updateUpdate name, description, or rerank threshold
bl knowledge deleteDelete a knowledge-base index
bl knowledge statsQuery storage and QPS metrics
bl knowledge doc uploadUpload local files/directories, optionally importing them
bl knowledge doc importImport existing data-center files into a knowledge base
bl knowledge doc syncSynchronize a local document directory
bl knowledge doc import-ossImport from OSS into the data center
bl knowledge doc listList knowledge-base documents and status
bl knowledge doc statusTrack an import job
bl knowledge doc tagUpdate data-center file tags
bl knowledge doc deleteDelete indexed documents and chunks
bl knowledge file getInspect a source file
bl knowledge file listList source files in a category
bl knowledge file deleteDelete a data-center source file
bl knowledge chunk addAdd a chunk
bl knowledge chunk listList chunks
bl knowledge chunk updateUpdate content or retrieval visibility
bl knowledge chunk deleteDelete chunks
bl knowledge category addCreate a category
bl knowledge category listList categories
bl knowledge category deleteDelete a category
bl knowledge collection createCreate a collection
bl knowledge collection getInspect a collection
bl knowledge service createCreate a retrieval/Q&A service draft
bl knowledge service listList services
bl knowledge service getInspect a service and its version configurations
bl knowledge service updateUpdate service metadata or draft configuration
bl knowledge service deployPublish a draft as a new version
bl knowledge service copyCopy a service to a new draft
bl knowledge service deleteDelete a service

Retrieval and Q&A

--agent-id must be a retrieval service ID, not a knowledge-base ID. The service configuration determines retrieval scope, multi-index recall, routing, ranking, and reranking. See Knowledge retrieval for service configuration.
FlagConstraint
--agent-id <id>Required retrieval service ID
--query <text>Query text; provide at least one of query or image, or both
--image <url>Repeatable image URL; image-only retrieval without query is supported
--agent-version <version>beta draft or a published version number; defaults to the latest published version
--kb-search-configs-file <path>JSON array file with knowledge-base IDs and online search_filters for each base
--workspace-id <id>Workspace ID, also configurable through the environment or config key
bl knowledge search --query "What is RAG?" --agent-id aid-xxx --workspace-id ws-xxx
bl knowledge search --agent-id aid-xxx --image https://example.com/query.jpg --workspace-id ws-xxx
bl knowledge search --query "Product documentation" --agent-id aid-xxx --kb-search-configs-file ./search-configs.json
Use --agent-version beta to debug before deployment. JSON output preserves request_id, data.total, data.cost_time, and data.nodes. Nodes contain score, text, and metadata such as title, document ID, URL, page number, and media URLs. Text mode prints scores, text, and media summaries per node.

chat

Call a Q&A service by ID for streaming RAG Q&A. See Knowledge Q&A for service configuration.
FlagConstraint
--agent-id <id>Required Q&A service ID
--message <text>Repeatable; accepts role:content, defaults to user, and follows the OpenAI message format
--image <url>Repeatable; attached as multimodal content to the last user message
--messages-file <path>Complete messages JSON array, including tool history; mutually exclusive with --message and --image
--agent-version <version>beta draft or a published version number; defaults to the latest published version
--enable-cache-control <true|false>Explicit context-cache control
--request-id <id>Business request ID
--session-file-id <fileId>Repeatable, up to 10; requires service-side file preprocessing
--workspace-id <id>Workspace ID, also configurable through the environment or config key
bl knowledge chat --message "What is RAG?" --agent-id aid-xxx --workspace-id ws-xxx
bl knowledge chat --agent-id aid-xxx --message "user:What is RAG?" --message "assistant:Retrieval-augmented generation." --message "user:What is it used for?"
bl knowledge chat --agent-id aid-xxx --messages-file ./messages.json --enable-cache-control true --request-id request-example --output json
The SSE lifecycle is tool_calling → tool_return → plan_start → planning → plan_end → generation_start → generating → generation_end. Tool calls and returns can repeat. JSON output separates the final answer from process information: read answer for the answer and phases, tools, docs, usage, and events for phases, tools, sources, usage, and events. Quiet does not reduce the result to an answer string. Scripts that extracted answers from quiet output should read JSON fields instead.

Migrate from retrieve

Bailian CLI 2.5.0 removed bl knowledge retrieve. Use bl knowledge search instead. Create a retrieval service bound to the target knowledge base and pass its --agent-id; do not reuse the old --index-id value. Configure recall, ranking, and reranking in the service rather than carrying over old retrieval flags. This statement does not establish version behavior for standalone kscli.

Knowledge-base management

init: recoverable sample initialization

bl knowledge init --dry-run
# Run only after confirming resource creation and billing
bl knowledge init --yes
FlagConstraint
--name <name>1–20 characters; default cli-demo
--state-file <path>Recovery checkpoint; default ~/.bailian/knowledge/init/<key>.json, keyed by workspace and name
--poll-interval <seconds>Polling interval; default 5 seconds
--workspace-id <id>Workspace ID
--yesConfirm knowledge-base creation and billing
The workflow uploads sample data, creates a knowledge base and retrieval service, and verifies the first retrieval, with recovery and resource reuse. It uses the retrieval service beta draft, does not publish a service, and does not create a Q&A service. Keep the state file for recovery. Dry-run still reads existing resources but changes neither resources nor checkpoints. Actual initialization without --yes is blocked with exit code 7. Use the cleanup actions in the output for knowledge bases you no longer need.

create: create and import

bl knowledge create --name demo --description 'product docs' --doc-id file-xxx --workspace-id ws-xxx --wait
FlagConstraint
--name <text>Required, 1–20 characters, unique in the workspace
--description <text>Required by the CLI, 1–500 characters; describe content and purpose
--doc-id <id>Repeatable data-center file ID; choose this or --category-id
--category-id <id>Import every file under each specified category; repeatable and mutually exclusive with --doc-id
--embedding-model <name>Document default: text-embedding-v4; multimedia/visual scenes: qwen3-vl-embedding
--knowledge-type <document|multimedia>Knowledge-base type
--knowledge-scene <scene>Scene; requires --knowledge-type
--multimodal-embedding-model <name>Alias of --embedding-model in multimedia/visual scenes
--chunk-size <n>Characters; CLI default 600, recommended 300–800
--waitPoll the initial import job to a terminal state
--poll-interval <seconds>Default 5 seconds
--workspace-id <id>Workspace ID
Structure and storage types are unstructured and BUILT_IN. Multimedia bases use basic_multimedia_qa, qwen3-vl-embedding, and qwen3-vl-rerank; explicitly selected models are validated by the server. The command returns the knowledge-base ID pipelineId and initial import job ID ingestionId. Track the job with doc status or --wait.
The required description and default chunk size of 600 are Bailian CLI constraints, not universal console or REST rules. The REST create API makes description optional and defines its own chunkSize default. Do not replace the CLI default of 600 with the REST default of 500.

list, info, update, delete, and stats

Each command below accepts --workspace-id <id>.
CommandRequired flagsOptional flags and behavior
bl knowledge listNo command-specific required flag--name <text> fuzzy match, 1–20 characters; --page-number <n> defaults to 1; --page-size <n>
bl knowledge info--index-id <id>Returns knowledge-base configuration
bl knowledge update--index-id <id>--name <text> 1–20 characters; --description <text>; --rerank-min-score <score> 0–1, filters out lower-scoring chunks
bl knowledge delete--index-id <id>--yes confirms permanent deletion of the base, documents, and chunk indexes; data-center source files remain
bl knowledge stats--index-id <id>--start <time> and --end <time> accept Unix seconds or ISO dates; defaults to the last 24 hours
Use the knowledge-base ID from list output as --index-id in management commands. Index settings such as embedding model and chunk size are immutable; recreate the base to change them. Monitoring timestamps are normalized to epoch seconds. Future start times are rejected; future end times are clamped to now.
bl knowledge list --workspace-id ws-xxx
bl knowledge info --index-id idx-xxx --workspace-id ws-xxx
bl knowledge update --index-id idx-xxx --description 'product docs v2' --workspace-id ws-xxx
bl knowledge stats --index-id idx-xxx --workspace-id ws-xxx
bl knowledge delete --index-id idx-xxx --workspace-id ws-xxx --dry-run

Documents and data-center files

A data-center file is the raw asset; importing it into a knowledge base creates an indexed document. Do not confuse fileId, document-level doc_id, and chunk IDs. Source-file deletion and indexed-document deletion are independent.

doc upload: upload local files

bl knowledge doc upload --file ./a.md --workspace-id ws-xxx
bl knowledge doc upload --file ./docs --index-id idx-xxx --wait
FlagConstraint
--file <path>Required, repeatable local file/directory; directories are scanned recursively, skipping unsupported formats and directories such as node_modules and .git
--index-id <id>Import after registration, using one import job for all files
--category-id <id>Target data-center category; resolves the workspace default when omitted
--tag <text>Repeatable; applied to every uploaded file
--category-type <UNSTRUCTURED|SESSION_FILE>File category type; SESSION_FILE is for temporary chat attachments
--parser <name>Parser, such as AUTO_SELECT or DOCMIND_LLM_VERSION_MEDIA
--parser-config-file <path>JSON object file containing parser configuration
--waitWait for the import job to reach a terminal state; requires --index-id
--poll-interval <seconds>Default 5 seconds
--workspace-id <id>Workspace ID
The pipeline is upload lease → streaming PUT to OSS → file registration → import job creation when index-id is supplied. Files are processed sequentially. On failure, the error hint lists already-registered file IDs.
This command supports audio/video files up to 2 GiB each. With --index-id, it processes at most 50 local media files per call, without automatic batching. These are Bailian CLI upload constraints. They do not replace the 512 MB audio/video file limit in console knowledge-base creation, nor establish a universal limit for REST uploads.

doc import: reuse existing files

bl knowledge doc import --index-id idx-xxx --doc-id file-xxx --wait
bl knowledge doc import --index-id idx-xxx --category-id category-xxx --dry-run
FlagConstraint
--index-id <id>Required existing knowledge-base ID
--doc-id <fileId> / --category-id <id>Choose one; each is repeatable. Here doc-id is a data-center file ID
--chunk-mode <mode>h1, h2, h3, h4, h5, length, page, or regex; document chunking, not video time slicing
--chunk-size <characters>1–6000 characters
--overlap-size <characters>0–1024 characters
--separator <regex>Separator for regex mode
--enable-headers <true|false>Whether to extract document headers
--waitWait for the import job to finish
--poll-interval <seconds>Default 5 seconds
--workspace-id <id>Workspace ID
This reuses file IDs without re-uploading, but can trigger parsing, indexing, and model charges. Keep the returned import job ID for later doc status queries. Do not assume that the init/sync --state-file flag is supported by this command.

doc sync: synchronize a local directory

bl knowledge doc sync --dir ./docs --index-id idx-example --dry-run
# Run after confirming the affected paths
bl knowledge doc sync --dir ./docs --index-id idx-example --yes
# Preview deletion of managed documents missing locally
bl knowledge doc sync --dir ./docs --index-id idx-example --delete --dry-run
FlagConstraint
--dir <path>Required local document directory
--index-id <id>Required target knowledge-base ID
--category-id <id>Data-center category; defaults to the workspace default on the first run
--deleteDelete managed index documents that no longer exist locally
--sync-id <uuid>Synchronization set UUID
--state-file <path>Checkpoint; default <dir>/.bailian/sync/<key>.json, keyed by knowledge-base ID
--poll-interval <seconds>Default 5 seconds
--yesConfirm high-risk operations
Synchronization can replace or delete managed index documents. Preview affected paths first. Replacement and deletion without --yes are blocked with exit code 7, not continued interactively. Keep the state file for subsequent synchronization/recovery. Allow only one writer per synchronization set, including across CI machines. Local source files remain. Imports may incur model charges; deleting documents does not stop knowledge-base running-time charges.

doc import-oss, list, status, tag, and delete

Each command below accepts --workspace-id <id>.
CommandRequired flagsOptional flags and behavior
bl knowledge doc import-oss--bucket <name>, --region <id>, --oss-key <key>Repeatable oss-key, 1–10 per call; --category-id <id> defaults to the workspace default; repeatable --tag <text>, up to 10; --overwrite replaces files previously imported from the same OSS keys
bl knowledge doc list--index-id <id>--page-number <n> defaults to 1; --page-size <n> server default 10, maximum 100; displays parse/index status
bl knowledge doc status--index-id <id>, --job-id <id>job-id is ingestionId; --page-number <n> defaults to 1; --page-size <n>; --wait; --poll-interval <seconds> defaults to 5
bl knowledge doc tag--doc-id <id>, --tag <text>doc-id is a repeatable data-center file ID, 1–20 per call; tags are repeatable, up to 32 characters each; --mode <append|overwrite> defaults to append
bl knowledge doc delete--index-id <id>, --doc-id <id>doc-id is a repeatable knowledge-base document ID; --yes confirms irreversible deletion of documents and their chunks, leaving data-center source files intact
  • Authorize the OSS bucket to the platform service role first. Permission errors are passed through; check AliyunServiceRoleForBailian in the RAM console. File names come from the Object Key basename. --overwrite issues a new fileId and invalidates the old one.
  • doc list highlights FAILED documents in text mode. doc status requires both index-id and job-id. A SystemError may mean the job does not exist; check the ingestion ID in document-list output. Overall states are PENDING / RUNNING / COMPLETED. Per-document failures such as PARSE_FAILED exit non-zero and preserve the error.
  • doc tag applies the same tag set to every file. Server limits are 100 tags per file, 700 characters total, and 32 characters per tag.
  • Obtain document IDs from bl knowledge doc list before deletion instead of using upload fileIds directly. A doc_id from create can equal fileId; one imported through upload with index-id can include a workspace suffix. Deletion can take about 30 seconds to propagate. Output lists the IDs actually deleted.
bl knowledge doc import-oss --bucket my-bucket --region cn-beijing --oss-key docs/a.pdf --workspace-id ws-xxx
bl knowledge doc list --index-id idx-xxx --workspace-id ws-xxx
bl knowledge doc status --index-id idx-xxx --job-id job-xxx --workspace-id ws-xxx
bl knowledge doc tag --doc-id file-xxx --tag project-a --tag draft --workspace-id ws-xxx
bl knowledge doc delete --index-id idx-xxx --doc-id doc-xxx --workspace-id ws-xxx --dry-run

file get, list, and delete

Each command below accepts --workspace-id <id>.
CommandRequired flagsOptional flags and behavior
bl knowledge file get--file-id <id>Returns size, MD5, tags, timestamps, and other details
bl knowledge file list--category-id <id>--name <text> exactly matches the file name without its extension; repeatable --file-id <id> for exact matching; --next-token <token>; --max-result <n>
bl knowledge file delete--file-id <id>--yes confirms permanent deletion of the data-center file
file list requires a real category ID and does not resolve the literal default; find IDs with category list. To query a.md, pass a as name. Partial keywords do not match. Cursor pagination reuses the next token from the previous page. file delete does not delete documents or chunk indexes already imported into knowledge bases. Use doc delete to remove indexed content. To clean up both resource layers, verify their IDs and deletion scopes separately.
bl knowledge file get --file-id file-xxx --workspace-id ws-xxx
bl knowledge file list --category-id cate-xxx --workspace-id ws-xxx
bl knowledge file delete --file-id file-xxx --workspace-id ws-xxx --dry-run

Chunk management

Each command below accepts --workspace-id <id>.

chunk add

In practice, all supported knowledge-base types require --doc-id. Use the document-level ID from bl knowledge doc list, not a per-row doc_id from chunk list.
FlagConstraint
--index-id <id>Required knowledge-base ID
--doc-id <id>Document-level ID, required in practice
--content <text> / --content-file <path>Alternatives for a document-type chunk body; content is at most 6000 characters; content-file is UTF-8 plain text such as md/txt
--title <text>Document-type title, up to 50 characters
--image-url <url>Repeatable image URL for document-type chunks, up to 10
--field <key=value>Repeatable fields for table/image knowledge bases; keys are Excel column headers and values remain strings; mutually exclusive with content/title/image flags
Document, table, and image knowledge bases are supported; audio/video knowledge bases are not. Image-type documents do not accept text chunks; target text-type documents such as docx/pdf/txt. The API is idempotent but limited to 10 calls per second, so throttle batches. The response does not include a chunk ID; list chunks afterwards to locate the new entry.
bl knowledge doc list --index-id idx-xxx --workspace-id ws-xxx
# Replace doc-xxx with the document-level ID returned above
bl knowledge chunk add --index-id idx-xxx --doc-id doc-xxx --content "Additional knowledge-base content" --title intro --workspace-id ws-xxx

chunk list, update, and delete

CommandRequired flagsOptional flags and behavior
bl knowledge chunk list--index-id <id>--doc-id <id> filters by document; --page-number <n> defaults to 1; --page-size <n> server default 20, maximum 100
bl knowledge chunk update--index-id <id>, --chunk-id <id>, --doc-id <id>--content <text> or --content-file <path>; --title <text>; --exclude / --include control retrieval visibility (include is the default)
bl knowledge chunk delete--index-id <id>, --chunk-id <id>Repeatable chunk-id; sends automatic batches of 10 IDs; --yes confirms irreversible deletion
For update, use metadata._id as chunk-id and metadata.doc_id from the same chunk-list row as doc-id. This differs from add's document-level ID requirement. New content must be 10–6000 characters and within the knowledge base's maximum chunk size. content-file accepts UTF-8 plain text only, not parsed docx/pdf. Titles are 0–50 characters: an empty string clears the title, omission keeps it unchanged. Toggling include/exclude alone re-submits the existing content automatically. Batch-deletion failures separately report completed batches, batches with unconfirmed results, and unexecuted parts. Do not treat unconfirmed results as unexecuted operations and blindly retry everything.
bl knowledge chunk list --index-id idx-xxx --workspace-id ws-xxx
bl knowledge chunk update --index-id idx-xxx --chunk-id chunk-xxx --doc-id doc-xxx --content "Corrected knowledge-base content"
bl knowledge chunk delete --index-id idx-xxx --chunk-id chunk-a --chunk-id chunk-b --workspace-id ws-xxx --dry-run

Categories and collections

Categories organize files by business domain. Collections define storage, using platform-managed storage by default or your own OSS bucket. Each command below accepts --workspace-id <id>.
CommandRequired flagsOptional flags and behavior
bl knowledge category add--name <text>Name is 1–20 characters; --parent-id <id> creates a child category; --collection-id <id> defaults to the platform collection
bl knowledge category listNo command-specific required flagExact filters --collection-id <id> and --parent-id <id>; exact --name <text> (unlike fuzzy knowledge-base name matching); --next-token <token>; --max-result <n> defaults to 20
bl knowledge category delete--category-id <id>--yes confirms irreversible deletion; behavior for categories containing files/children is server-defined, with errors passed through
bl knowledge collection create--name <text>, --description <text>Creates a FILE collection; --store-type <platform|custom> defaults to platform; custom requires --oss-region <id> and --oss-bucket <name>
bl knowledge collection get--collection-id <id> or --name <text>Choose one to retrieve details
Files with no explicit category go into the category marked [default]. Category listing uses next-token cursor pagination. Custom buckets must be authorized and carry the bailian-connector-access=ReadAndWrite tag; otherwise creation can fail with setBucketCORS failed. There is currently no collection-delete API, so create collections deliberately.
bl knowledge category add --name product-docs --workspace-id ws-xxx
bl knowledge category list --workspace-id ws-xxx
bl knowledge category delete --category-id cate-xxx --workspace-id ws-xxx --dry-run
bl knowledge collection create --name my-collection --description 'team docs' --workspace-id ws-xxx
bl knowledge collection get --collection-id conn-xxx --workspace-id ws-xxx

Retrieval and Q&A service management

Services are the entry points for search/chat. Create and bind a knowledge base → verify the beta draft → deploy a published version. Each command below accepts --workspace-id <id>.

create, list, and get

CommandRequired flagsOptional flags and behavior
bl knowledge service create--name <text>, --scene <chat|search>Name up to 200 characters, unique per scene in the workspace; --description <text> up to 1000 characters, recommended to explain capabilities and audience; --index-id <id> binds a base, with other settings using server defaults
bl knowledge service list--scene <chat|search>--status <draft|deployed|deleted> (deployed includes edited); fuzzy --name <text>; exact --agent-id <id> and --index-id <id>; --page-number <n> defaults to 1; --page-size <n>
bl knowledge service get--agent-id <id>--agent-version <version> selects beta or a published number; omission returns all versions, with valid versions determined by server state
New services have draft status and beta version. Run list once per scene to view both chat and search services. Use the returned agent_id for calls or service management. Creating a service requires knowledge-base create permission in the workspace.
bl knowledge service create --name my-search --scene search --index-id idx-xxx --workspace-id ws-xxx
bl knowledge service list --scene search --workspace-id ws-xxx
bl knowledge service get --agent-id aid-xxx --workspace-id ws-xxx
bl knowledge search --query "What is RAG?" --agent-id aid-xxx --agent-version beta --workspace-id ws-xxx

update: change the draft

bl knowledge service update requires --agent-id <id>.
Optional flagConstraint
--name <text> / --description <text>Name up to 200 characters; description up to 1000
--agent-version <version>Defaults to beta; published versions accept only --version-desc
--version-desc <text>Version description
--policy <turbo|agentic>Fast or multi-turn policy
--model <name>Generation model code, required to be on the platform allowlist
--temperature <n>0–2
--max-llm-calls <n>Maximum LLM calls per request, 1–30
--enable-session-file <true|false>Enable session files
--enable-refusal <true|false>Enable refusal answers
--enable-anti-leak <true|false>Enable prompt-leak prevention
--enable-rich-text <true|false>Enable rich-text output
--enable-citation <true|false>Enable citations
--config-file <path>JSON file replacing the whole agent_config, for nested settings such as kb_search_configs; mutually exclusive with scalar config flags
Scalar configuration uses read-merge-write against the draft; config-file replaces the entire configuration. Published configuration cannot be changed directly. Update beta, verify with --agent-version beta on search/chat, then deploy a new version. Updating requires knowledge-base modify permission.
bl knowledge service update --agent-id aid-xxx --temperature 0.7 --workspace-id ws-xxx

deploy, copy, and delete

CommandRequired flagsOptional flags and behavior
bl knowledge service deploy--agent-id <id>--version-desc <text>, --yes; publishes beta, automatically increments the version, and sets status to deployed; requires knowledge-base modify permission
bl knowledge service copy--agent-id <id>Copies to a beta draft with a copy_ name prefix; requires knowledge-base create permission; verify and deploy separately
bl knowledge service delete--agent-id <id>--yes; soft-delete and idempotent, so repeated deletion succeeds, but deletion cannot be undone; requires knowledge-base delete permission
Deployment changes behavior for live callers. After deletion, the agent_id cannot be used for search/chat. Actual deployment or deletion requires explicit --yes; otherwise the command is blocked with exit code 7. Do not interpret the confirmation requirement as an interactive continuation prompt.
bl knowledge service deploy --agent-id aid-xxx --workspace-id ws-xxx --dry-run
# Run only after confirming the deployment impact
bl knowledge service deploy --agent-id aid-xxx --workspace-id ws-xxx --yes
bl knowledge service copy --agent-id aid-xxx --workspace-id ws-xxx
bl knowledge service delete --agent-id aid-xxx --workspace-id ws-xxx --dry-run