Skill: nb-clh/agentic-rag-cn (version 1.0.0)

--- name: deep-research description: Deep web research across 11 Chinese and international sources (Baidu, Bing, Sogou, Quark, ChinaSo, WeChat, Yandex, Zhihu, Bilibili, V2EX, GitHub). Use when the user asks for deep research, comprehensive search, multi-source search, or needs results from Chinese platforms (Zhihu, Bilibili, WeChat). Falls back to built-in web_search if the API is unavailable. --- # Deep Research Search across 11 sources simultaneously via a local Agentic RAG-CN API, then synthesize results with evidence tables and contradiction detection. ## Prerequisites Agentic RAG-CN must be running locally. Check with: ```bash curl -s http://localhost:18888/health ``` If unavailable, fall back to built-in `web_search` tool. ## Usage Call the API with a POST request: ```bash curl -s -X POST http://localhost:18888/api/analyze \ -H "Content-Type: application/json" \ -d '{"question": "用户的问题"}' ``` Parse the JSON response and present results to the user in a readable format. ## Response Format The API returns: - `answer` — Structured answer with evidence tables - `sources` — List of sources used (with URLs) - `confidence` — Confidence score (0-1) - `contradictions` — Any contradictions found across sources - `trace` — Pipeline execution trace (16 steps) ## When to Use vs Fallback | Condition | Action | |-----------|--------| | API health check succeeds | Use deep-research API | | API health check fails | Fall back to `web_search` | | User asks about Chinese topics (知乎, B站, 微信) | Prefer deep-research | | User asks general English questions | `web_search` is usually sufficient | ## Presenting Results Format the response as: 1. **Answer summary** — 2-3 sentences 2. **Evidence table** — Key findings with sources 3. **Contradictions** (if any) — Highlight conflicting info 4. **Sources** — Numbered list of URLs

path: references/api.md
content: # API Reference

## Endpoints

### GET /health

Health check. Returns `{"status": "ok"}` if running.

### POST /api/analyze

Main research endpoint.

**Request body:**
```json
{
  "question": "搜索问题"
}
```

**Response:**
```json
{
  "answer": "结构化答案",
  "sources": [
    {"title": "...", "url": "...", "source": "baidu"}
  ],
  "confidence": 0.85,
  "contradictions": [],
  "trace": {
    "elapsed_seconds": 12.5,
    "steps": ["web_search", "vector_search", "..."]
  }
}
```

### POST /search

Raw search without RAG pipeline. Returns unprocessed search results.

**Request body:** Same as `/api/analyze`.

## Error Codes

| Code | Meaning |
|------|---------|
| 200 | Success |
| 422 | Invalid request body |
| 500 | Internal error |
| 503 | Service unavailable |


path: scripts/api_call.py
content: #!/usr/bin/env python3
"""Deep Research API health check and query tool."""

import sys
import json
import urllib.request
import urllib.error

API_BASE = "http://localhost:18888"

def health_check():
    """Check if the API is running."""
    try:
        req = urllib.request.Request(f"{API_BASE}/health", method="GET")
        with urllib.request.urlopen(req, timeout=5) as resp:
            data = json.loads(resp.read())
            print(f"✅ API healthy: {data.get('status', 'ok')}")
            return True
    except (urllib.error.URLError, ConnectionRefusedError, OSError):
        print("❌ API unavailable")
        return False

def query(question):
    """Send a research query."""
    payload = json.dumps({"question": question}).encode("utf-8")
    req = urllib.request.Request(
        f"{API_BASE}/api/analyze",
        data=payload,
        headers={"Content-Type": "application/json"},
        method="POST"
    )
    try:
        with urllib.request.urlopen(req, timeout=120) as resp:
            data = json.loads(resp.read())
            return data
    except (urllib.error.URLError, ConnectionRefusedError, OSError) as e:
        return {"error": str(e)}

if __name__ == "__main__":
    if len(sys.argv) < 2:
        print("Usage: python api_call.py <question>")
        print("       python api_call.py --health")
        sys.exit(1)

    if sys.argv[1] == "--health":
        ok = health_check()
        sys.exit(0 if ok else 1)

    question = " ".join(sys.argv[1:])
    print(f"Searching: {question}")
    result = query(question)

    if "error" in result:
        print(f"Error: {result['error']}")
        sys.exit(1)

    print(f"\nAnswer:\n{result.get('answer', 'No answer')}")
    if result.get("contradictions"):
        print(f"\nContradictions:\n{result['contradictions']}")
    print(f"\nSources: {len(result.get('sources', []))}")


Security scan verdicts — ClawScan: clean | static analysis: clean | VirusTotal: clean | SkillSpector: suspicious (HIGH)