Invocation and limits
- Vector retrieval: Provide at least one of
agent_idandpipeline_id_list. If both are provided,agent_idtakes precedence. With onlypipeline_id_list, knowledge bases are searched directly using the default strategy. - Service-based retrieval: When using
agent_id, configure and publish the service in the console first. An unpublished service returnsRagAgentNotExist. Omitagent_versionto use the currently published version. - Query intent: Vector retrieval requires at least one of
queryandimages.queryis limited to 4500 UTF-8 bytes.imagesaccepts up to 10 items; only the first image is used. Image-only search requires a knowledge base with image extraction enabled. - Search scope:
pipeline_id_listaccepts up to 15 items;file_id_listaccepts up to 10. Omittingfile_id_listor passing[]adds no document restriction. In vector retrieval, it is merged and deduplicated with thedoc_idfilter; the scope is their union. - Rate limit: Up to 10 requests per 10 seconds. The limiting dimension is pending confirmation; actual service throttling applies. See Rate limits for handling recommendations.
Wiki retrieval
Enabling Wiki on a knowledge base automatically creates a corresponding Wiki retrieval service. Call List Agents with agent_scene=search and search_type=wiki, optionally adding pipeline_id, to obtain its agent_id.
agent_idis required. All bound knowledge bases must have Wiki enabled, otherwiseWikiNotEnabledis returned. The retrieval type is fixed at service creation.queryis required and must not be empty. Image queries and direct Wiki retrieval throughpipeline_id_listare not supported.file_id_listcauses an error only when non-empty.[]is equivalent to omitting it.doc_id,tags, and custom metadata filters are not supported. Only the following filter fields are supported.
| Filter field | Type and description |
|---|---|
page_type | String or string array; SUMMARY / ENTITY / CONCEPT / INDEX / SYNTHESIS / COMPARISON, case-insensitive |
folder_id | Folder ID, string; an empty string denotes the root folder |
category_path | Folder name path from the root to the current folder, string array |
page_type, returns empty results rather than an error. An unsupported filter field returns InvalidParameter.Disabling Wiki does not delete the existing Wiki retrieval service. Its original agent_id becomes usable again after Wiki is re-enabled. This does not restore old pages or mean that all data disappears immediately on disable; wait for cleanup and regeneration to finish.Wiki request example
Filters and strategies
kb_search_configs takes effect only when agent_id is provided. Each id must be present, non-empty, bound to the service, and unique within the request.
- Request
search_filtersare appended to service-configured conditions with AND, not substituted. The serialized merged array for each knowledge base must not exceed 80000 UTF-8 bytes. - Vector retrieval supports
doc_id,tags, and custom metadata fields written to the index. The top-leveltagsarray for an unstructured knowledge base is limited to 1000 items. - Both retrieval modes support logical grouping with
_operator(AND / OR, case-insensitive) and_conditions. - Field comparison supports
eq/neq/like/unlike/is_null/gt/gte/lt/lte. Set operators includecontains/ncontains/intersect/nintersect/within/nwithin.
agent_config and cannot be overridden in the request. See the parameter table above for full fields and filter examples.
Response
data.total is the number of results returned, equal to the length of nodes; cost_time is latency in milliseconds. Each result contains score, text, and metadata. score may be null; its range depends on retrieval and reranking models and is not restricted to 0–1.
Wiki results have metadata.source_type=WIKI_PAGE and page fields including wiki_page_id, slug, title, summary, page_type, wiki_path, category_path, source_doc_ids, and version (see WikiSearchNodeMetadata). text contains the title and summary by default, not necessarily the full body. Verify critical content against the source documents identified by source_doc_ids.
_ are used for internal scoring and may change between versions; do not depend on them in business logic. Vector retrieval from tabular knowledge bases also returns business fields from the table schema.Error handling
Always check success. On failure, status is ERROR; the response-body status_code is a business status code, not the transport-layer HTTP status. Use code and message together, and provide request_id when troubleshooting.
| code | status_code | Typical scenario |
|---|---|---|
InvalidParameter | 400 | No valid retrieval target, invalid query intent, exceeded limits, non-empty Wiki file_id_list, or unsupported Wiki filter field |
RagAgentGroupNotExist | 400 | Service does not exist, or a knowledge base ID is passed as agent_id |
RagAgentNotExist | 400 | Service unpublished or specified version not found |
WikiNotEnabled | 400 | Not all bound knowledge bases have Wiki enabled |
code and message values. The shared InvalidParameter code alone does not identify the cause.Authorizations
DashScope API Key, obtained from the API Key page in the console.
Body
application/jsonKnowledge retrieval service ID, not a knowledge base ID, obtainable via List Agents. Uses the service's retrieval strategy; the retrieval type is fixed at creation and cannot be switched at call time. Find Wiki services with agent_scene=search + search_type=wiki; do not substitute a regular chunk retrieval service ID.
- Vector retrieval: provide at least one of
agent_idandpipeline_id_list; if both are provided,agent_idtakes precedence. - Wiki retrieval: required.
Query text, limited to 4500 UTF-8 bytes.
- Vector retrieval: provide at least one of
queryandimages; for image-only retrieval, omit the text or pass an empty string. - Wiki retrieval: required and must not be empty.
Publicly accessible image URLs, up to 10 items. Only the first image is used.
- Vector retrieval: can be combined with
query; image-only retrieval requires a knowledge base with image extraction enabled. - Wiki retrieval: image queries are not supported.
Document IDs restricting the search scope, up to 10 items. Omitted or empty adds no document restriction.
- Vector retrieval: merged and deduplicated with the
doc_idfilter; the search scope is their union. - Wiki retrieval: only a non-empty array causes an error;
[]is equivalent to omitting it.
Knowledge base IDs for direct retrieval, up to 15 items.
- Vector retrieval: provide at least one of this array and
agent_id; if both are provided,agent_idtakes precedence. When using this array alone, it must not be empty; retrieval uses the default strategy. - Wiki retrieval: not supported; use
agent_id.
Retrieval service version, used with agent_id. Defaults to the currently published version.
Per-knowledge-base filters, effective only when agent_id is provided. Each item contains a knowledge base ID and its filters.
Response
Business status code. Success on success; otherwise the error code string.
Business status code in the response body, not the transport-layer HTTP status. See the error reference.
Status enum. SUCCESS on success, ERROR on failure.
Whether the request succeeded. Callers should use this field as the primary verdict.
Status description.
Unique request identifier. Include this ID when reporting an issue.