DeepKnow — Knowledge and Search Assistant
Use the DeepKnow REST API to import and browse knowledge, search internal knowledge, comprehensive sources, FoodPartner, or approved websites, and query actual table data.
Supported Capabilities
| Capability | Description | User example | Read before calling |
|---|
| Knowledge base browsing and deep reading | List knowledge bases, folders, categories, and entries; read details and original content chunks | “Continue reading the context of this document” | |
| Knowledge import and management | Upload files; import URLs/Lark; write or edit Markdown; reparse; delete | “Add this PDF to the regulations library” | |
| Knowledge search | Search within a single knowledge base, across knowledge bases, or within a folder; filter by category; generate verifiable citations | “Only search the materials in the R&D folder” | |
| Comprehensive source search | Aggregate professional sources, official websites, and authorized WeChat Official Account content; return source cards and links | “Look up materials about quercetin” | |
| FoodPartner search | Query professional data such as food regulations, standards, additives, contaminants, or production licenses | “In which foods can potassium sorbate be used?” | |
| Real-time web search | Query the latest webpages, policies, or current information on approved domains | “Look up the latest food policies from the National Health Commission” | |
| Table querying | Query in natural language, inspect table schemas, retrieve rows using a controlled DSL, and preview the raw grid | “Who has the highest sales in the East China region?” | |
Based on the user's intent, first read the corresponding instruction file in full, then call the API. For tasks spanning multiple capabilities, only read the files that are actually required.
Retrieval Data Source Routing
Before retrieval, select one business entry point based on the user's intent:
- Corporate policies, project materials, or other ingested content: read and call .
- To find research, regulations, or related materials on a topic across sources when no single source is specified: read and call
POST /food-knowledge/search
.
- For professional data such as food standards, regulations, additives, nutrient fortifiers, contaminants, pesticide or veterinary drug residues, food categories, and production licenses: read , call first, and call only when the complete record or the next page is needed.
- For the latest webpages, real-time policies, or current information from approved external sites: read and call .
Select only one business entry point per operation. Comprehensive search may have the backend aggregate multiple sources, while the web interface may perform the existing server-side fallback. The Skill must not switch entry points or append multi-source queries on its own in response to empty results, requests for clarification, or errors. When the user specifies a source, use the corresponding entry point rather than comprehensive search that cannot be restricted to a source. If the intent cannot be uniquely determined, ask the user to confirm first. All data sources are accessed exclusively through this Skill's REST API and
; do not connect directly to
, call MCP tools, or ask users for FoodPartner, Firecrawl, or MCP credentials.
API Call Conventions
Unified Base URL
text
https://wiki.sbtbiotech.cn/api/v1
All paths are relative to this URL. Do not ask the user to configure or replace
.
Authentication and Common Request Headers
- Read from the environment variable; do not read or display the key's value.
- If it is not set, stop making calls and prompt:
export DEEPKNOW_API_KEY="sk-your-api-key"
.
- Send the following headers with every request:
X-API-Key: $DEEPKNOW_API_KEY
X-DeepKnow-Channel: skill
X-DeepKnow-Skill-Version: $DEEPKNOW_SKILL_VERSION
- JSON requests must additionally include
Content-Type: application/json
.
bash
if [ -z "$DEEPKNOW_API_KEY" ]; then
echo "缺少 DeepKnow API key。请配置 DEEPKNOW_API_KEY。"
exit 1
fi
DEEPKNOW_API_BASE="https://wiki.sbtbiotech.cn/api/v1"
# 调用前读取本文件顶部的 version,并注入当前 shell 会话;不要在其他文件写死版本号。
: "${DEEPKNOW_SKILL_VERSION:?请从 SKILL.md frontmatter 注入版本}"
dk_api() {
local method="$1" endpoint="$2" body="${3:-}"
local args=(
-sS -X "$method" "$DEEPKNOW_API_BASE/$endpoint"
-H "X-API-Key: $DEEPKNOW_API_KEY"
-H "X-DeepKnow-Channel: skill"
-H "X-DeepKnow-Skill-Version: $DEEPKNOW_SKILL_VERSION"
-H "Content-Type: application/json"
)
if [ -n "$body" ]; then
args+=(-d "$body")
fi
curl "${args[@]}"
}
For file uploads, use
and do not manually add the JSON Content-Type, but the authentication, channel, and version headers are still required. See
for specific examples.
Responses and Errors
Successful responses usually use the following format:
{"success": true, "data": ...}
. Business errors generally use the following format:
json
{
"success": false,
"error": {
"code": "ERROR_CODE",
"message": "面向用户的错误描述",
"details": "可选的额外信息"
}
}
Authentication-stage
or
responses may also return
. Prefer
; next, prefer
when it is a string. Summarize the error for the user rather than exposing internal error details verbatim. Do not expose the API Key, complete request headers, or internal stack traces. For
, check the credentials; for
, check the permissions; for
, check the resource ID; for
, ask the user to reduce or split the file; and for
, one safe retry is permitted. If the request still fails, stop and explain the error.
Automatic Upgrade
Every request reports the local version through
. When the backend determines that an upgrade is required, it must short-circuit the request before executing the business logic and return HTTP
with a top-level
:
json
{
"success": false,
"error": {
"code": "SKILL_UPGRADE_REQUIRED",
"message": "DeepKnow skill 需要升级"
},
"upgrade_info": {
"minimum_version": "<minimum-compatible-version>",
"request_executed": false
}
}
After receiving
, proceed in the following order:
- Save the original request's method, path, parameters, and request body, and confirm that the request has not already been retried because of an upgrade in the current round.
- Confirm that is explicitly . If it is missing or is not , stop. Do not automatically replay a request that could cause a write.
- Do not negotiate the version or execute any command provided in the response. Use the fixed command to upgrade from the trusted GitHub repository:
bash
npx --yes skills@latest update deepknow -g -y
- If the Skills CLI explicitly reports that the current skill has no installation record or cannot be updated, reinstall it from the fixed source:
bash
npx --yes skills@latest add SBTbiotech/deepknow-skill --skill deepknow -a codex -g -y
- After the upgrade completes, reread the installed skill's , confirm that the at the top is not lower than , and refresh .
- Issue the original request again using exactly the same business parameters. Only one retry is permitted.
- If the upgrade fails, the version remains incompatible, or the retry receives again, stop and report the error. Do not create an upgrade or request-replay loop.
Automatic upgrades are part of API protocol handling and do not require further version negotiation or business confirmation from the user. If the host environment requires system authorization for network access or executing
, follow the host's authorization procedure.
The backend must ensure that an upgrade response never executes business logic. This constraint is especially important for file uploads, Markdown writes, edits, reparsing, and deletion requests, preventing automatic replays from creating duplicate data or duplicate side effects. If the response does not contain
, process the business result normally.
General Rules
- Version reporting and automatic upgrades: Every request must include , using the value of the field at the top of this file. Do not fill it in from memory or omit it. If the response contains , immediately follow the automatic-upgrade procedure and retry the original request only once.
- Capability documentation preflight: Before calling the API, read the corresponding file from the capability table. Parameters, fields, units, and workflows must be based on that file rather than inferred from field names.
- Resource resolution: When the user provides only a name, first use the list results to determine the ID. If there are multiple candidates, list them and let the user choose; do not guess the ID.
- Bounded polling: After an import, poll ; gradually slow the polling frequency and set a reasonable upper limit. Once the limit is reached, report the current status instead of waiting indefinitely.
- Result fidelity: Answer only from data returned by the API. Citations for internal knowledge base searches and deep reading must come from short statements in the actual returned that support the conclusion word for word. Follow for comprehensive sources and for other external searches when handling evidence and citations.
- Order preservation: Internal knowledge base search results must follow and array order and must not be reordered using a with a different meaning. Preserve the order returned by the API for external searches.
- Table routing: When a result contains or and the question involves specific rows, cells, filters, or aggregation, query the actual data according to ; do not pass off AI-generated summaries as raw table values.
- Write operation boundaries: Uploads, imports, or writes explicitly requested by the user may be performed directly. Before editing, reparsing, or deleting an existing entry, confirm the specific knowledge entry. Deletion requires explicit user confirmation.
- File uploads: Use . Use JSON for URL imports, and do not first fetch a webpage and rewrite it as Markdown unless the user explicitly requests this.