For AI agents. After reading this, an agent can autonomously install the Knowledge Studio Skill, configure credentials, and verify it works — restart and the KB is queryable in conversation.
Autonomous setup guide for AI agents. Completing this document installs the Knowledge Studio Skill, readies credentials, and — after a client restart — enables Knowledge Base retrieval and Q&A directly in conversation.
All three are required before the Skill can actually call the API:
Run in a terminal (replace
Supported agents:
Scope: current project by default; add
The Skill's retrieval scripts call the DashScope API with
Option B: Auto-create via Alibaba Cloud CLI (no manual key handling)
Best when you'd rather not touch keys. The Skill creates and stores one on first call:
The RAM user needs the
Or check the file exists:
After restart, just ask in natural language — the Agent invokes the Skill automatically:
Prerequisites
All three are required before the Skill can actually call the API:
- Node.js ≥18 — download
- Bailian Knowledge Base service activated — open the Knowledge Base page, click "Activate Now", wait 1–2 minutes. Without it, calls return
403 Forbidden - DashScope API Key — create on the API Key page, format
sk-xxx. Note:sk-sp-xxxis a Coding Plan Key and is not supported for Knowledge Base services
Install the Skill
Run in a terminal (replace --agent with yours):
| Agent | --agent value |
|---|---|
| Claude Code | claude-code |
| Qoder | qoder |
| Qwen Code | qwen-code |
| Cursor | cursor |
| Codex | codex |
| Gemini CLI | gemini-cli |
| GitHub Copilot | github-copilot |
| OpenClaw | openclaw |
-g for global (all projects).
Configure the API Key (critical)
The Skill's retrieval scripts call the DashScope API with Authorization: Bearer, so an API Key is mandatory. Scripts auto-fetch it in this priority:
- Alibaba Cloud CLI config
~/.aliyun/config.json, current profile'sdashscope.api_key - Environment variable
DASHSCOPE_API_KEY - Auto-created when Alibaba Cloud CLI is available
~/.zshrc / ~/.bashrc), or set for the current session:
AliyunBailianFullAccess system policy, or a custom policy with modelstudio:ListWorkspaces, modelstudio:CreateApiKey, modelstudio:DeleteApiKey.
Verify the install
.<agent>/skills/alibabacloud-bailian-rag-knowledgebase/SKILL.md (e.g. .claude/skills/...).
Restart the agent client
Using it after restart
After restart, just ask in natural language — the Agent invokes the Skill automatically:
- "List my knowledge bases"
- "Search the 'Product Documentation' KB: what auth methods are supported?"
id and name), retrieves relevant chunks for the question, and composes an answer with sources appended (KB name; document name; section).
Troubleshooting
| Symptom | Cause | Fix |
|---|---|---|
401 InvalidApiKey | Key missing or invalid | Check DASHSCOPE_API_KEY or dashscope.api_key in ~/.aliyun/config.json |
403 Forbidden / Service not activated | KB service not activated | Open the KB page, click "Activate Now" |
| Agent doesn't see the Skill | not restarted / wrong dir / missing SKILL.md | Restart client; check .<agent>/skills/alibabacloud-bailian-rag-knowledgebase/SKILL.md |
npx skills add fails | old Node / network | confirm Node ≥18, retry |
More info
- Console Service Channels page has interactive install commands
- Alibaba Cloud Skills docs