← Back to library

RAG Skill 接入前置健康检查:先测 /healthz 再执行索引与检索

场景:知识库 API 不可用时直接索引会导致任务链失败。技巧:把 check-connection 脚本放在 Skill 前置步骤,先验活性再发起 index/query。

GITHUBDiscovered 2026-02-14Author mfittko
Prerequisites
  • rag-stack services are deployed locally or remotely and accessible by URL.
  • OpenClaw AgentSkill can execute Node scripts before API calls.
Steps
  1. Run connectivity check script against RAG_STACK_URL and stop pipeline on non-zero exit.
  2. If healthy, proceed with repository indexing command and wait for completion signal.
  3. Issue a natural-language query and compare topK snippets with expected code area.
  4. On health failure, return actionable diagnostics instead of blind retries.
Commands
docker compose up -d
node skill/scripts/check-connection.mjs http://localhost:8080
node dist/index.js index --repo https://github.com/<org>/<repo>.git --api http://localhost:8080
node dist/index.js query --api http://localhost:8080 --q authentication --topK 5
Verify

Health check returns ok true, index completes, and query returns semantically relevant chunks for known questions.

Caveats
  • Skill implementation is from a new PR; script path and command contract may change before merge.
  • Embedding model pull and vector index build can be time-consuming on low-resource hosts.
Source attribution

This tip is aggregated from community/public sources and preserved with attribution.

Open original source ↗
Visit original post