SuperAPI AI Directory

bk-cli-aidev

Agents & models

View repository

Updated 10-26 17:43

About this skill

bk-cli aidev — BlueKing AIDev resource capabilities

Used to call BlueKing AIDev private OpenAPI via bk-cli aidev .

CRITICAL — Before starting, you MUST first read ../bk-cli-shared/SKILL.md. The shared skill handles authentication, context, tenant, stage, dry-run, verbose, header/body, and general request rules; this skill only supplements the semantics and input conventions of the aidev commands themselves.

Current coverage

bk-cli aidev provides AIDev resource query and management capabilities, including commands for spaces, Skills, MCPs, Prompts, agents, knowledge bases, knowledge documents, credentials, resource references, resource collections, and upload/import.

The complete command list is governed by bk-cli aidev --help , and individual command parameters are governed by bk-cli aidev <action> --help .

Input conventions and common pitfalls

  • Before calling AIDev, configure the login credentials for the current context according to the shared skill, and ensure the identity has the corresponding space and API permissions. Deployments that support Bearer authentication can use a personal token; when using application and user credentials, both identities must be provided and the corresponding API permissions requested.
  • CLI flag names keep the upstream OpenAPI parameter names unchanged, for example space_id、skill_id、mcp_type、agent_code、page_size。
  • list_skills、list_agents etc. For GET list commands, space_id can be omitted or passed as all, meaning query all spaces within the current tenant for which you have permission;list_knowledges must be passed a real space ID in the body, and does not support all。
  • Actions with complex request bodies are uniformly passed via the shared --body '<json>' ; actions that require a request body at execution time are locally validated for non-empty --body .
  • To view request body structures, use bk-cli aidev <action> -h --body-schema。
  • upload_file is a file upload command; use --file、--space_id and the optional --module to send multipart/form-data, not --body。

Common workflows

  1. Use list_spaces to confirm accessible spaces and record the target space_id。
  2. When uploading a Skill or knowledge ZIP, first use upload_file or get_upload_url to obtain the artifact address, then call the Skill upsert or knowledge import command.
  3. Before managing Skills, MCPs, Prompts, or agents, first use the corresponding list_* command to locate the ID; for write operations, verify in a test space or test stage first.
  4. When managing agents, typically operate in the order "create/update Agent → bind Skill / MCP / KnowledgeBase → publish_agent publish".
  5. After importing or rebuilding knowledge, use get_knowledge_status or check_upload_status to query the processing status.
  6. When managing credentials, first use list_credential_types to confirm the credential type, then create, bind, unbind, or delete the credential.

Commands

Spaces

list_spaces

bk-cli aidev list_spaces
bk-cli aidev list_spaces --keyword demo
  • List the spaces and space_ids accessible to the current calling identity, with support for keyword filtering. Applies when the target space has not yet been determined; this API does not grant space permissions.
  • No need to pass space_id; you can use --keyword to fuzzy search by space name.

Skill

list_skills

bk-cli aidev list_skills --space_id demo-space --page 1 --page_size 20
bk-cli aidev list_skills --space_id all --fuzzy demo
  • Filter Skills by space and fuzzy keyword and obtain IDs; results may be paginated, and callers need to precisely compare skill_code item by item. Applies to deduplication before syncing or Agent Skill reference resolution.
  • Common filters:fuzzy、generate_type、group_type、tag_id、tag_name、page、page_size。

upsert_skill

bk-cli aidev upsert_skill \
  --body '{"space_id":"demo-space","skill_code":"demo-skill","skill_name":"Demo Skill","description":"demo description","url":"bkrepo://demo.zip"}'
  • Create or update a Skill using the uploaded Skill artifact by skill_code. An existing code will be updated; whether the same version can be overwritten is controlled by allow_version_overwrite. Use after completing the ZIP upload and version verification.
  • Required in the request body:space_id、skill_code、skill_name、description、url。
  • url Usually comes from the upload result of upload_file or get_upload_url .
  • By default, overwriting an existing same version is allowed; to prohibit it, pass in the body "allow_version_overwrite":false。

get_skill

bk-cli aidev get_skill --skill_id 1 --space_id demo-space
bk-cli aidev get_skill --skill_id 1 --space_id demo-space --version v1.0.0
  • Read the configuration of the specified Skill; when version is passed, read that version. Use for comparison before syncing, confirming versions, or resolving Agent references.
  • Required:skill_id、space_id;version When not passed, the latest version is returned.

archive_skill

bk-cli aidev archive_skill --skill_id 1 --body '{"space_id":"demo-space"}'
  • Archive the specified Skill. Verify the target ID, version, and Agent references first, then execute.
  • Required:skill_id and a DELETE request body containing the real space_id ; explicitly pass the space ID via --body , which does not support all。

get_skill_download_url

bk-cli aidev get_skill_download_url --skill_id 1 --space_id demo-space
  • Get a temporary download link for the specified Skill file. Use to verify or download existing artifacts; the link expires and is not used for uploading new versions.
  • Required:skill_id、space_id。

list_skill_versions

bk-cli aidev list_skill_versions --skill_id 1 --space_id demo-space
  • List the historical versions of the specified Skill. Use to select a version to view or download; does not change the current version.
  • Required:skill_id、space_id。

MCP

list_mcps

bk-cli aidev list_mcps --space_id demo-space --mcp_type apigw
bk-cli aidev list_mcps --space_id all --fuzzy demo --page 1 --page_size 20
  • List MCP candidates by space, mcp_code, and type; results may be paginated. Use for resource discovery; when establishing Agent references, use by-code for precise confirmation instead.
  • mcp_type Can be used to filter apigw or resource; when not passed, both resource-type and APIGW MCP are returned.
  • Common filters:agent_code、mcp_code、mcp_name、created_by、updated_by、tag_names。

create_mcp

bk-cli aidev create_mcp \
  --body '{"space_id":"demo-space","mcp_name":"Demo MCP","mcp_code":"demo-mcp","url":"https://mcp.example.com/mcp","protocol":"streamable_http","credential_type":"custom","description":"demo description","credential_id":1}'
  • Create an MCP configuration in the specified space. Use when a new MCP is genuinely needed; to have an Agent reference an existing MCP, first use by-code for a precise query.
  • url Must be an HTTP(S) MCP service address; upload artifact addresses cannot be used.credential_type When it is custom , credential_id;null does not require a credential ID;blueapps also requires a BlueKing gateway URL.
  • The request body structure follows bk-cli aidev create_mcp -h --body-schema .

get_mcp

bk-cli aidev get_mcp --mcp_id 1 --mcp_type apigw --space_id demo-space
bk-cli aidev get_mcp --mcp_id 1 --mcp_type resource --space_id demo-space
  • Read MCP details by type and ID. Use to verify resource-type or APIGW MCP configuration after obtaining the exact ID.
  • Required:mcp_id、mcp_type、space_id;mcp_type Common values are apigw or resource。
  • When querying APIGW authorization-related MCP, you may additionally pass --agent_code。

get_mcp_register_json

bk-cli aidev get_mcp_register_json --mcp_id 1 --mcp_type apigw --space_id demo-space
  • Get the MCP registration JSON for the specified type and ID, for external clients to register tools; does not create an MCP, nor authorize an Agent.
  • Required:mcp_id、mcp_type、space_id; when querying APIGW authorization-related MCP, you may additionally pass --agent_code。

get_mcp_by_code

bk-cli aidev get_mcp_by_code --mcp_code demo-mcp
bk-cli aidev get_mcp_by_code --mcp_code demo-mcp --space_id demo-space --mcp_type apigw --agent_code demo-agent
  • Precisely resolve the MCP's ID, type, and available scope by mcp_type and mcp_code. Use when an Agent configuration references an MCP; passing agent_code allows checking APIGW MCP based on the target Agent's associated scenario.
  • Required:mcp_code;space_id May be omitted or passed as all。

get_resource_mcp

bk-cli aidev get_resource_mcp --mcp_id 1 --space_id demo-space
  • Read the details of the specified resource-type MCP. Use to verify configuration when the resource-type MCP ID is known.
  • Required:mcp_id、space_id。

Prompt

list_prompts

bk-cli aidev list_prompts --space_id demo-space --page 1 --page_size 20
bk-cli aidev list_prompts --space_id all --prompt_code demo --prompt_name Demo
  • List Prompts by space and filter conditions; results may be paginated. Use to locate an existing Prompt code or ID; an Agent's inline Prompt does not require creating a separate Prompt first.
  • Common filters:fuzzy、prompt_code、prompt_name、generate_type、group_type、created_by、tag_id、tag_name。

upsert_prompt

bk-cli aidev upsert_prompt \
  --body '{"space_id":"demo-space","prompt_code":"demo-prompt","prompt_name":"Demo Prompt","content":"demo content"}'
  • Create or update a standalone Prompt by prompt_code in the current space. Use when a reusable Prompt genuinely needs to be maintained; an existing code will update the online content.
  • The request body structure follows bk-cli aidev upsert_prompt -h --body-schema .

get_prompt

bk-cli aidev get_prompt --prompt_id 1 --space_id demo-space
  • Read the detailed configuration of the specified Prompt. Use it to verify content before reusing or modifying an existing Prompt.
  • Required:prompt_id、space_id。

Agent

list_agents

bk-cli aidev list_agents --space_id demo-space --page 1 --page_size 20
bk-cli aidev list_agents --space_id all --agent_code demo-agent --agent_name Demo
  • Find an agent by space, agent_code, or name and obtain its ID; results may be paginated. Use it to determine whether a resource already exists before syncing; do not treat fuzzy match results directly as the unique target.
  • Common filters:fuzzy、agent_code、agent_name、generate_type、created_by、tag_id、tag_name。

create_agent

bk-cli aidev create_agent \
  --body '{"space_id":"demo-space","agent_name":"Demo Agent","agent_code":"demo-agent"}'
  • Create an agent in the specified space and return the Agent ID for subsequent configuration updates. Use it when the agent_code does not yet exist; creation may involve the developer center, so confirm the space, code, and name first.
  • The request body structure follows bk-cli aidev create_agent -h --body-schema .

get_agent

bk-cli aidev get_agent --agent_id 1 --space_id demo-space
bk-cli aidev get_agent --agent_id 1 --space_id demo-space --version v1.0.0
  • Read the configuration of the specified agent: if version is not passed, return the current draft configuration; if version is passed, return the specified published version. Use it to compare drafts, verify dependencies, or read published sub-agent configurations before syncing.
  • Required:agent_id、space_id;version If not passed, the current draft configuration is returned.

archive_agent

bk-cli aidev archive_agent --agent_id 1 --body '{"space_id":"demo-space"}'
  • Archive the specified agent; published plugin applications may be taken offline asynchronously. Use it when you explicitly want to remove an agent; first verify the target ID and resource references.
  • Required:agent_id and a DELETE request body containing the real space_id ; pass the space ID explicitly via --body ; all。

publish_agent

bk-cli aidev publish_agent \
  --agent_id 1 \
  --body '{"space_id":"demo-space","agent_id":1}'
  • Submit a publish request for the specified agent and return the version and status. It is recommended not to pass version and let the platform generate it automatically: 1.0.0 for the first time, then increment the last digit; pass it only when a specific version number is truly needed. pending or running means background processing, which does not equal publish or deployment completion.
  • Required:agent_id and the request body.

update_agent

bk-cli aidev update_agent \
  --agent_id 1 \
  --body '{"space_id":"demo-space","agent_id":1}'
  • Update the configuration of an existing agent, including references such as model, Prompt, knowledge base, Skill, and MCP. Use it to sync configuration after dependency resolution and difference verification; it will change the online agent.
  • Required:agent_id and the request body.

append_agent_admins

bk-cli aidev append_agent_admins \
  --agent_id 1 \
  --body '{"space_id":"demo-space","agent_id":1,"admins":["username"]}'
  • Append administrators to the developer center plugin corresponding to the agent, keeping existing members; does not modify Agent users or space permissions. Use it to add administrators after the Agent is created.
  • Required:agent_id and the request body;admins must contain the usernames to append; omitting it,null or [] will not append anyone. The caller needs space access and agent management permissions.

Knowledge Base

create_knowledgebase

bk-cli aidev create_knowledgebase --body '{"space_id":"demo-space","name":"demo"}'
  • Create a knowledge base configuration in the specified space and return the ID. Use it when knowledgebase_code does not exist; document content must be uploaded and imported separately.
  • The request body structure follows bk-cli aidev create_knowledgebase -h --body-schema .

get_knowledge_stats

bk-cli aidev get_knowledge_stats --space_id demo-space
  • Read the statistics summary of knowledge bases and knowledge documents accessible to the current calling identity within the specified space. Use it to understand counts and file sizes; it does not query by a single knowledge base ID, nor does it return complete configurations.
  • Required:space_id。

list_knowledgebases

bk-cli aidev list_knowledgebases
  • Filter knowledge bases by space and knowledgebase_code and obtain IDs; code filtering is fuzzy matching, and the caller must compare each item precisely. This is a read-only query; although it uses POST, results may be paginated. Use it for duplicate checking or Agent reference resolution before syncing.
  • Request parameters follow bk-cli aidev list_knowledgebases --help .

delete_knowledgebase

bk-cli aidev delete_knowledgebase --id 1 --body '{"space_id":"demo-space"}'
  • Delete the specified knowledge base. First confirm the knowledge within it, Agent references, and the impact of deletion, then execute.
  • Required:id and a DELETE request body containing the real space_id ; pass the space ID explicitly via --body ; all。

update_knowledgebase

bk-cli aidev update_knowledgebase \
  --id 1 \
  --body '{"space_id":"demo-space","id":1}'
  • Update the configuration of an existing knowledge base. Use after the ID has been found and configuration differences have been checked; does not complete a standalone knowledge document ZIP import.
  • Required:id and the request body.

query_knowledgebase

bk-cli aidev query_knowledgebase --body '{"space_id":"demo-space","query":"hello"}'
  • Initiate a retrieval over the knowledge base content in the specified space and return the matching results. Use to answer knowledge questions; not for looking up knowledge base configuration or syncing documents.
  • The request body structure follows bk-cli aidev query_knowledgebase -h --body-schema .

Knowledge document

create_knowledge

bk-cli aidev create_knowledge \
  --body '{"space_id":"demo-space","knowledge_base_id":1,"knowledge_name":"Demo Knowledge","file_name":"demo.md","file_path":"demo.md","url":"bkrepo://demo.md"}'
  • Create a knowledge document in the specified knowledge base. Use for adding a single document; for batch or whole-directory ZIP sync, choose the corresponding interface.
  • The upload result is placed in url;file_path is the relative path within the knowledge base; the file name must match file_name , e.g. demo.md。
  • The request body structure follows bk-cli aidev create_knowledge -h --body-schema .

batch_create_knowledges

bk-cli aidev batch_create_knowledges --body '{"space_id":"demo-space","items":[{"knowledge_base_id":1,"knowledge_name":"Demo Knowledge","file_name":"demo.md","file_path":"demo.md","url":"bkrepo://demo.md"}]}'
  • Create multiple knowledge documents at once. Use for multiple additions from the same confirmed batch of input; for whole-directory ZIP sync, use archive/import.
  • Requires --body, structure follows bk-cli aidev batch_create_knowledges -h --body-schema .

batch_update_knowledges

bk-cli aidev batch_update_knowledges --body '{"space_id":"demo-space","items":[{"id":1,"knowledge_name":"Updated Knowledge"}]}'
  • Update multiple existing knowledge documents at once. Use for batch operations where each target ID and modification content has been confirmed.
  • Requires --body, structure follows bk-cli aidev batch_update_knowledges -h --body-schema .

batch_delete_knowledges

bk-cli aidev batch_delete_knowledges --body '{"space_id":"demo-space","ids":[1]}'
  • Delete multiple knowledge documents at once. Use for batch cleanup where each target ID and the deletion impact have been checked item by item.
  • Requires --body, structure follows bk-cli aidev batch_delete_knowledges -h --body-schema .

list_knowledges

bk-cli aidev list_knowledges --body '{"space_id":"demo-space"}'
  • List the knowledge documents in the specified knowledge base or directory; this is a read-only query, although it uses POST. Use to confirm the document scope after import or to locate document IDs.
  • This list interface passes query conditions via body;space_id must be a real space ID and cannot be omitted or passed as all。

preview_knowledge_link

bk-cli aidev preview_knowledge_link --body '{"space_id":"demo-space","url":"bkrepo://demo.zip"}'
  • Preview the content of a remote link to be imported. Use to check readability before creating link-type knowledge; does not create a knowledge document.
  • Requires --body, structure follows bk-cli aidev preview_knowledge_link -h --body-schema .

get_knowledge_structure_header

bk-cli aidev get_knowledge_structure_header --body '{"space_id":"demo-space","url":"bkrepo://demo.zip"}'
  • Read the structure header information of a remote file, for confirming fields before importing structured knowledge; does not create or update knowledge.
  • Requires --body, structure follows bk-cli aidev get_knowledge_structure_header -h --body-schema .

verify_knowledge_link

bk-cli aidev verify_knowledge_link --body '{"space_id":"demo-space","url":"bkrepo://demo.zip","knowledgebase_type":"document"}'
  • Verify whether the knowledge link to be used is valid. Use for pre-checks before creating or updating link-type knowledge; does not save the document.
  • Requires --body, structure follows bk-cli aidev verify_knowledge_link -h --body-schema .

preview_knowledge

bk-cli aidev preview_knowledge --id 1 --space_id demo-space
  • Read the preview content of the specified knowledge document. Use to check the main text, not to obtain the full index configuration.
  • Required:id、space_id。

get_knowledge_status

bk-cli aidev get_knowledge_status --space_id demo-space
bk-cli aidev get_knowledge_status --space_id demo-space --anchor_path /1 --group_type document
  • Query knowledge processing status statistics and visible ZIP import tasks by space and anchor_path. Use to check whether a task already exists before import, or to query progress after submission; does not trigger a retry.
  • Required:space_id; may additionally supply anchor_path、group_type。

trigger_knowledge_update

bk-cli aidev trigger_knowledge_update --body '{"space_id":"demo-space","id":1}'
  • Trigger an update task for an existing knowledge document. Use when a re-fetch or update is explicitly needed; may generate background processing.
  • If anchor_path is not passed, the document idmust be provided; example: update knowledge document 1.
  • Requires --body, structure follows bk-cli aidev trigger_knowledge_update -h --body-schema .

list_knowledge_update_frequencies

bk-cli aidev list_knowledge_update_frequencies
  • List the update frequency options supported for knowledge documents, for selection when creating or updating configuration; does not trigger an update.

get_knowledge_index_info

bk-cli aidev get_knowledge_index_info --id 1 --space_id demo-space
  • Read the index configuration of the specified knowledge document. Use to check chunking, cleaning, and retrieval settings; does not return the document body.
  • Required:id、space_id。

reclean_knowledge

bk-cli aidev reclean_knowledge --body '{"space_id":"demo-space","id":1}'
  • Re-clean and rebuild knowledge artifacts using the current or specified import pipeline. Use when you confirm existing artifacts need to be rebuilt; this triggers background processing.
  • In the request body, provide at least one of id or a non-empty ids to select the document to be re-cleaned.
  • Requires --body, with the structure following bk-cli aidev reclean_knowledge -h --body-schema .

delete_knowledge

bk-cli aidev delete_knowledge --id 1 --body '{"space_id":"demo-space"}'
  • Delete the specified knowledge document. Use when explicitly removing a single document; first confirm the ID and impact.
  • Required:id and a DELETE request body containing the actual space_id ; pass the space ID explicitly via --body is not supported. all。

update_knowledge

bk-cli aidev update_knowledge \
  --id 1 \
  --body '{"space_id":"demo-space","id":1}'
  • Update the content or configuration of the specified knowledge document. Use for single-document modifications where the document ID has already been located.
  • Required:id and the request body.

import_knowledge_archive

bk-cli aidev import_knowledge_archive \
  --body '{"space_id":"demo-space","url":"bkrepo://demo.zip","file_name":"demo","file_type":"zip","anchor_path":"/1"}'
  • Asynchronously import an uploaded or remote ZIP into the specified anchor_path, overwriting the target directory contents. Use for directory-based document sync; after a task ID is returned, query status_info with the same anchor_path. Do not treat a successful submission as completed processing.
  • anchor_path must be /<知识库ID> or /<知识库ID>/<目录>; do not pass only /; example: /1 refers to knowledge base 1.
  • Import progress can be queried by calling anchor_path with the same get_knowledge_status .

Credentials

list_credential_types

bk-cli aidev list_credential_types
  • List the creatable credential types and configuration fields. Use when the credential type or form structure is not yet clear; this endpoint does not create credentials.

list_credentials

bk-cli aidev list_credentials --space_id demo-space --page 1 --page_size 20
bk-cli aidev list_credentials --space_id all --credential_name demo --credential_types custom
  • Find credential configurations by space and filter conditions; results may be paginated. Use to locate credentials to be bound or maintained; do not treat list results as plaintext secrets.
  • Common filters:credential_name、credential_types、page、page_size。

create_credential

bk-cli aidev create_credential \
  --body '{"credential_name":"demo-credential","credential_type":"custom","credential_detail":{"key":"demo-key","value":"demo-value"},"space_id":"demo-space"}'
  • Create a credential configuration in the specified space and return the credential ID. Call only when a new credential is clearly needed and the fields have been confirmed; credential lifecycle and binding relationships are managed separately.
  • First use list_credential_types to confirm the type fields; thecustom of credential_detail requires key and value。
  • The request body structure follows bk-cli aidev create_credential -h --body-schema .

update_credential

bk-cli aidev update_credential \
  --credential_id 1 \
  --body '{"credential_name":"demo-credential","credential_type":"custom","credential_detail":{"key":"demo-key","value":"demo-value"},"space_id":"demo-space","credential_id":1}'
  • Update the configuration of the specified credential. Use when the credential ID has been verified and fields need to be changed; this may affect resources already bound to the credential.
  • Required:credential_id and the request body.

batch_delete_credentials

bk-cli aidev batch_delete_credentials --body '{"space_id":"demo-space","credential_ids":[1]}'
  • Batch delete specified credentials; first confirm the IDs and reference relationships one by one. Use to clean up multiple credentials confirmed to be no longer in use at once.
  • Requires --body, with the structure following bk-cli aidev batch_delete_credentials -h --body-schema .

delete_credential

bk-cli aidev delete_credential --credential_id 1 --body '{"space_id":"demo-space"}'
  • Delete the specified credential. First query references and confirm unbinding or the scope of impact, then perform the deletion.
  • Required:credential_id and a DELETE request body containing the actual space_id ; pass the space ID explicitly via --body is not supported. all。

bind_credential

bk-cli aidev bind_credential --body '{"space_id":"demo-space","credential_id":1,"resource_type":"mcp","resource_id":1}'
  • Bind an existing credential to the target resource. Use when both the credential and resource are determined; this changes the credential association of the target resource.
  • Requires --body, with the structure following bk-cli aidev bind_credential -h --body-schema .

unbind_credential

bk-cli aidev unbind_credential --body '{"space_id":"demo-space","credential_id":1,"resource_type":"mcp","resource_id":1}'
  • Unbind the credential from the target resource. Use when explicitly revoking this association; this may affect the target resource's ability to call external services.
  • Requires --body, with the structure following bk-cli aidev unbind_credential -h --body-schema .

list_credential_references

bk-cli aidev list_credential_references --credential_id 1 --space_id demo-space
  • Query which resources reference the specified credential. Use to assess impact before updating, unbinding, or deleting.
  • Required:credential_id、space_id。

Tags

list_tags

bk-cli aidev list_tags
bk-cli aidev list_tags --scope_name BUSINESS
  • Retrieve the full tag tree within the specified scope for the current tenant, so that tags can be selected during agent configuration; no space or agent needs to be specified.
  • Optional:scope_name. If omitted, the agent tag scope configured at deployment is used (default default), and the business scope is BUSINESS。agent is not a scope name; unrecognized values fall back to the general default scope.

Resource references and resource collections

list_resource_references

bk-cli aidev list_resource_references --instance_id 1 --resource_type skill --space_id demo-space
  • Query which Agents reference a resource of the specified type and ID. Useful for assessing impact before deleting or changing resources such as Skills, MCPs, or knowledge bases.
  • Required:instance_id、resource_type、space_id;resource_type Common values include agent、collection、knowledgebase、llm、mcp、skill、tool。

list_collections

bk-cli aidev list_collections --space_id demo-space --collection_name Demo
bk-cli aidev list_collections --space_id all --collection_code demo-collection
  • Look up a role Prompt Collection by space and collection_code to obtain the collection_id; results may be paginated. Useful for resolving Agent references or checking for duplicates before syncing.
  • Common filters:collection_code、collection_name、page、page_size。

upsert_collection

bk-cli aidev upsert_collection \
  --body '{"space_id":"demo-space","collection_code":"demo-collection","collection_name":"Demo Collection","content":[{"role":"system","content":"你是示例角色"}]}'
  • Create or update a role Prompt Collection by collection_code and return the collection_id. Useful for syncing the role instructions referenced by an Agent; an existing code will update the online content.
  • content must contain at least one message, the first role must be system, and message content cannot be empty.
  • The request body structure follows bk-cli aidev upsert_collection -h --body-schema .

get_collection

bk-cli aidev get_collection --collection_id 1 --space_id demo-space
  • Read the message content and configuration of the specified role Prompt Collection. Useful for comparison before syncing, or for confirming an existing Collection referenced by an Agent.
  • Required:collection_id、space_id。

apply_cross_space_resources

bk-cli aidev apply_cross_space_resources \
  --body '{"space_id":"demo-space","resource_type":"skill","resource_ids":[1]}'
  • Initiate a cross-space usage request for the specified resource, returning the request ID and approval ticket information. Useful when the target space does not yet have resource usage permission; submitting a request does not mean authorization has taken effect.
  • The request body structure follows bk-cli aidev apply_cross_space_resources -h --body-schema .

Upload and import

upload_file

bk-cli aidev upload_file --file ./artifact.zip --space_id demo-space
bk-cli aidev upload_file --file ./knowledge.zip --space_id demo-space --module knowledge
  • Upload a local file directly, returning the path, metadata, and expiration time.
  • Required:file、space_id;module Defaults to skill, common values are skill or knowledge。
  • Do not use --body. The file must exist and be a readable regular file; it is read as a stream during upload, and--dry-run validates the path and displays the file size size(bytes).

get_upload_url

bk-cli aidev get_upload_url --body '{"space_id":"demo-space","file_name":"demo.zip","module":"skill"}'
  • Request a time-limited, one-time direct upload URL for a Skill or knowledge ZIP. Useful for direct upload of large files; after obtaining the URL, you still need to upload the file and verify its status.
  • module Defaults to knowledge, Skill direct upload must explicitly specify "module":"skill"; knowledge ZIP uses "module":"knowledge"。
  • The returned upload_url is only for one-time upload; after a successful upload, use the returned url to call Skill upsert, knowledge ZIP import, or check_upload_status。

check_upload_status

bk-cli aidev check_upload_status --body '{"space_id":"demo-space","url":"bkrepo://demo.zip"}'
  • Query and verify whether the direct-upload file exists, its size range, and SHA256 format, returning the actual file size and digest. The caller still needs to compare with the local file; useful for confirming results after upload or timeout, and it does not re-upload.
  • Can be queried after upload failure or timeout; if the file is incomplete, the upstream returns an error and does not automatically re-upload.

Troubleshooting suggestions

  • First use --dry-run to confirm whether the request URL, stage, query, and body are as expected.
  • If a permission error occurs, also check whether the current login identity and application have applied for the AIDev API permission.
  • If the request body is missing, first run bk-cli aidev <action> -h --body-schema to view the fields, then add --body。