The kscli search, chat, and retrieve commands — consume Knowledge Bases through a retrieval service
These three commands consume Knowledge Bases:
Run semantic retrieval against a Knowledge Base.
Parameters
Output
With no matches the command prints
Hold a RAG conversation with a Knowledge Base, with streaming output.
Parameters
At least one of
When output is redirected or piped, the full text is buffered and printed at once.
Query a single Knowledge Base directly.
Parameters
Output
Same format as
search runs semantic retrieval, chat holds a multi-turn conversation, and retrieve queries a single Knowledge Base directly but is deprecated.
Shared conventions for authentication, workspace ID, global flags, and output formats are covered in the CLI overview. The examples below assume the workspace ID is already set in the config file; retrieve does not use a workspace ID.
Choosing a command
| Command | Input | When to use |
|---|---|---|
search | --agent-id | Semantic retrieval. Scope and strategy come from the service config, supporting multiple Knowledge Bases, routing, and reranking |
chat | --agent-id | Multi-turn Q&A. Streams the model-generated answer |
retrieve | --index-id | Deprecated. Queries one Knowledge Base directly, limited in capability and no longer developed |
kscli search
Run semantic retrieval against a Knowledge Base.
| Parameter | Type | Required | Description |
|---|---|---|---|
--query <text> | string | Yes | Query text, cannot be empty |
--agent-id <id> | string | Yes | Retrieval service ID, found with service list --scene search |
--agent-version <version> | string | No | Service version, beta (draft) or a published number. Defaults to the latest published version |
--image <url> | array | No | Image URL, repeatable, for multimodal retrieval |
No results found.. json mode returns the full result including each hit's score and metadata.
Notes
- Retrieval scope and strategy (multi-Knowledge-Base weighting, routing, reranking, and so on) come from the service configuration behind
--agent-id, so only--queryand--agent-idare needed — retrieval parameters do not have to be repeated on the command line. --agent-version betacalls the draft configuration, which is how you validate tuning before publishing.
kscli chat
Hold a RAG conversation with a Knowledge Base, with streaming output.
| Parameter | Type | Required | Description |
|---|---|---|---|
--message <text> | array | Yes | Message text, repeatable. Supports a role:content prefix to set the role (such as user:hello), defaulting to user, and follows the OpenAI message format |
--agent-id <id> | string | Yes | Q&A service ID, found with service list --scene chat |
--agent-version <version> | string | No | Service version, beta (draft) or a published number. Defaults to the latest published version |
--image <url> | array | No | Image URL, repeatable, attached to the last user message |
--message or --image is required — an image-only query can pass --image alone. --image cannot be combined with a structured message that already contains image content.
Output
In an interactive terminal the answer streams in real time, and the progress label follows the server-side stage:
json mode returns:
quiet mode prints the complete answer text.
Notes
- Pass conversation history by repeating
--messagewithrole:prefixes. --verbosewrites detailed streaming events to stderr, which helps diagnose interruptions or anomalies.- On
Chat API error, check that--agent-idexists, the service is published, and the API Key is valid. The error code and message are returned verbatim by the server.
kscli retrieve
Query a single Knowledge Base directly.
| Parameter | Type | Required | Description |
|---|---|---|---|
--index-id <id> | string | Yes | Knowledge Base ID |
--query <text> | string | Yes | Query text |
--dense-similarity-top-k <n> | number | No | Semantic retrieval recall count |
--sparse-similarity-top-k <n> | number | No | Keyword retrieval recall count |
--rerank | switch | No | Enable reranking |
--rerank-top-n <n> | number | No | Number of results after reranking |
--rerank-model <name> | string | No | Rerank model name, such as qwen3-rerank-hybrid |
--rerank-mode <mode> | string | No | Rerank mode, qa, similar, or custom |
--rerank-instruct <text> | string | No | Custom rerank instruction, used with --rerank-mode custom |
--top-k <n> | number | No | Number of results. Deprecated — use --rerank-top-n |
search. With no matches the command prints No results found..
Notes
- This command does not need a workspace ID; it queries
--index-iddirectly without requiring a retrieval service. --top-kis deprecated and prints a warning on stderr when passed — use--rerank-top-n.