query / images) and agent_id, and can specify document/tag filters per Knowledge Base via kb_search_configs.
Parameter classification
The request surface stays minimal. Parameters fall into two classes by role:
| Class | Meaning | Owner | In request? |
|---|---|---|---|
| A · agent strategy | Search strategies that belong to the agent | Locked in agent_config, configured and published from the console | No |
| B · call intent | Inputs known only at call time | Request body | Yes |
dense_similarity_top_k, sparse_similarity_top_k, rerank, rerank_top_n, rerank_min_score, hybrid_rerank, enable_kb_router, kb_search_configs[].weight, enable_rewrite, enable_nl2sql — all managed in agent_config and not overridable from the request.
B-class examples: query, images, kb_search_configs[].id, kb_search_configs[].search_filters.
kb_search_configs
Use kb_search_configs to specify document/tag filter conditions per Knowledge Base at request time, enabling runtime dynamic filtering. This field is an array; each element corresponds to one Knowledge Base.
kb_search_configs[].idmust be a Knowledge Base ID already bound in the agent's offline config — you cannot query unbound Knowledge Bases.- Duplicate
idvalues are not allowed within the same request. - Each
kb_search_configselement must include anidfield. - Total
search_filtersbyte size must not exceed 80,000 bytes. Unstructured Knowledge Bases only allowtagsandmetakeys, with array length up to 1,000. - Filterable fields must be declared in
index_config.fieldswhen the Knowledge Base is indexed, or filtering has no effect.
Response
Response data contains total (matched chunk count), nodes (result list), and cost_time (latency in ms). Each node has score, text, and metadata; see the parameter table above for field details.
_ are internal scores and may change between versions — don't build business logic on them. Spreadsheet Knowledge Bases also return business fields from your own table (field names vary by table schema).Error handling
On failure, success is false, status is ERROR, status_code is the semantic code, code is the error code string, message is the description, and request_id is always returned. Always check success rather than relying on the HTTP status alone; provide request_id when reporting an issue.
| Scenario | Error code | Message |
|---|---|---|
Missing agent_id | InvalidParameter | agent_id is required |
Missing query | InvalidParameter | query is required |
| kb_id not bound to agent | InvalidParameter | kb not bound to agent: {id} |
| Duplicate kb_id | InvalidParameter | duplicate kb id in kb_search_configs: {id} |
| Empty kb_id | InvalidParameter | kb_search_configs[{i}].id is required |
| search_filters byte size exceeded | InvalidParameter | search_filters total bytes must less than 80000 |
| Invalid key in unstructured filter | InvalidParameter | search_filters[{i}] contains invalid key '{key}'. Only 'tags' and 'meta' are allowed for unstructured data |
| Unstructured tags/meta array exceeded | InvalidParameter | search_filters[{i}].tags array size must not exceed 1000 |
Authorizations
DashScope API Key, obtained from the API Key page in the console.
Body
application/jsonKnowledge Search service (agent) instance ID. The server loads the published agent_config (with all A-class search strategies) by this ID. Create and publish it on the Knowledge Search page in the console.
Text search intent. At least one of query and images must be provided; pass an empty string for image-only search; required when images is absent, otherwise InvalidParameter is returned.
Image search intent. Each element is a publicly accessible image URL. At least one of query and images must be provided; pass both for multimodal search.
Agent version. The standard interface exposes only agent_id / agent_version / query / images / kb_search_configs; all other search strategies go through agent_config and are not exposed in the request.
Knowledge Base filter configuration array. Each element corresponds to one Knowledge Base and can specify document/tag filters. id must be a Knowledge Base already bound to the agent; duplicates are not allowed within the same request.
Response
Business status code. Success on success; otherwise the error code string.
Semantic status code. 200 on success.
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.