Cloudsway Search:排序搜索 + 动态摘要

深度解析 SandBase 上的 Cloudsway Search——为 AI Agent 设计的排序网络搜索 + 动态摘要 API,架构、场景、代码和与语义搜索的对比。

结论先行 — Cloudsway Search 是 SandBase 上的网络搜索 API,返回排序结果 + 动态摘要,专为需要实时结构化网络数据的 AI Agent 设计。一个操作、干净输出:标题、URL、摘要片段、相关度评分和可选全文提取。最适合研究型 Agent、事实核查工作流和竞争情报,即需要权威排序结果而非语义匹配的场景。

Cloudsway Search 做什么

Cloudsway Search 是通过 SandBase 提供的搜索即服务工具。不同于 LLM 知识(训练时冻结)或向量数据库(仅限已索引内容),Cloudsway 让你的 Agent 访问实时网络结果——按相关度排序,附加摘要。

输出为 Agent 消费而结构化:

{
  "results": [
    {
      "title": "字节跳动发布 Seedream 5.0 Pro - AI 图像生成",
      "url": "https://example.com/seedream-5-release",
      "snippet": "字节跳动宣布 Seedream 5.0 Pro,最新图像生成模型...",
      "score": 0.95,
      "published_date": "2026-07-15",
      "summary": "Seedream 5.0 Pro 是字节跳动的生产级图像模型,提供两个变体..."
    }
  ],
  "query_interpretation": "image generation model bytedance 2026",
  "total_results": 142
}

核心特性:

  • 排序结果 — 按相关度排列,不止关键词匹配
  • 动态摘要 — AI 生成的每条结果摘要,根据查询上下文定制
  • 时效性 — 实时网络索引,非过期缓存数据
  • 结构化输出 — JSON 格式直接供 Agent 处理,无需解析 HTML
  • 单一操作 — 一次 API 调用获取全部

SandBase 上的 API 用法

通过 SandBase 的 /v1/run 端点访问:

from openai import OpenAI

client = OpenAI(
    base_url="https://api.sandbase.ai/v1",
    api_key="your-sandbase-api-key"
)

# 基础搜索
response = client.post("/v1/run", body={
    "model": "cloudsway/search",
    "operation": "search",
    "input": {
        "query": "AI Agent 记忆架构最佳实践 2026",
        "num_results": 10
    }
})

results = response.json()["output"]["results"]
for r in results:
    print(f"[{r['score']:.2f}] {r['title']}")
    print(f"  {r['url']}")
    print(f"  {r['summary']}")

高级搜索参数

# 带过滤和选项的搜索
response = client.post("/v1/run", body={
    "model": "cloudsway/search",
    "operation": "search",
    "input": {
        "query": "企业级 AI Agent 部署策略",
        "num_results": 20,
        "include_full_text": True,    # 包含完整页面内容
        "freshness": "month",         # 仅最近一月结果
        "language": "zh",             # 语言过滤
        "include_summary": True       # 生成逐条摘要
    }
})

results = response.json()["output"]["results"]
for r in results[:3]:
    print(f"标题: {r['title']}")
    print(f"全文长度: {len(r.get('full_text', ''))} 字符")
    print(f"摘要: {r['summary']}")

架构:排序搜索 vs 语义搜索

理解何时用 Cloudsway、何时用语义搜索(如 Exa),需要理解各自机制:

维度Cloudsway(排序搜索)语义搜索(如 Exa)
匹配方式相关度排序(BM25 + 神经重排)嵌入向量相似度
索引实时网络索引精选网络内容
最适合查找某主题的权威来源按含义/概念查找内容
查询风格自然语言或关键词自然语言描述
时效性实时网络取决于爬取频率
输出排序列表 + 摘要内容 + 相似度分数
优势广度、时效、权威信号精度、概念匹配

用 Cloudsway 的场景:

  • “X 领域最新进展是什么?”
  • “找到关于 Y 的权威来源”
  • “大家怎么评价 Z?”
  • 竞争情报、市场调研、新闻监控

用语义搜索的场景:

  • “找到与这篇文档相似的内容”
  • “哪些页面从 Y 角度讨论了 X 概念?”
  • “找到匹配这个特定技术描述的资源”

Agent 应用场景

场景一:研究型 Agent

Agent 围绕主题收集信息并生成结构化报告:

class ResearchAgent:
    """用 Cloudsway Search 收集和综合信息的 Agent。"""
    
    def __init__(self, api_key: str):
        self.client = OpenAI(
            base_url="https://api.sandbase.ai/v1",
            api_key=api_key
        )
    
    def research_topic(self, topic: str, depth: int = 3) -> dict:
        """多轮搜索研究一个主题。"""
        
        # 第一轮:宏观概览
        overview = self._search(f"{topic} 概览指南 2026", num_results=10)
        
        # 第二轮:提取子话题,逐个搜索
        subtopics = self._extract_subtopics(overview, topic)
        detailed = {}
        for sub in subtopics[:depth]:
            detailed[sub] = self._search(f"{topic} {sub} 详细", num_results=5)
        
        # 第三轮:寻找反面/替代观点
        contrarian = self._search(f"{topic} 挑战 问题 批评", num_results=5)
        
        return {
            "overview": overview,
            "subtopics": detailed,
            "challenges": contrarian
        }
    
    def _search(self, query: str, num_results: int = 10) -> list[dict]:
        response = self.client.post("/v1/run", body={
            "model": "cloudsway/search",
            "operation": "search",
            "input": {"query": query, "num_results": num_results, "include_summary": True}
        })
        return response.json()["output"]["results"]
    
    def _extract_subtopics(self, results: list[dict], topic: str) -> list[str]:
        summaries = "\n".join(r["summary"] for r in results if r.get("summary"))
        response = self.client.chat.completions.create(
            model="openai/gpt-4o-mini",
            messages=[{
                "role": "user",
                "content": f"根据以下关于'{topic}'的摘要,列出 5 个值得深入的子话题:\n\n{summaries}"
            }],
            max_tokens=200
        )
        return response.choices[0].message.content.strip().split("\n")

场景二:事实核查 Agent

通过搜索支持/反驳证据来验证声明:

class FactCheckAgent:
    """通过网络搜索证据验证声明。"""
    
    def __init__(self, api_key: str):
        self.client = OpenAI(
            base_url="https://api.sandbase.ai/v1",
            api_key=api_key
        )
    
    def verify_claim(self, claim: str) -> dict:
        """核查一条声明。"""
        support = self._search(f"{claim} 证据 确认")
        contra = self._search(f"{claim} 辟谣 错误 不实")
        
        confidence = self._score(support, contra)
        
        return {
            "claim": claim,
            "confidence": confidence,
            "verdict": self._verdict(confidence),
            "supporting": support[:3],
            "contradicting": contra[:3],
        }
    
    def _search(self, query: str) -> list[dict]:
        response = self.client.post("/v1/run", body={
            "model": "cloudsway/search",
            "operation": "search",
            "input": {"query": query, "num_results": 5, "include_summary": True}
        })
        return response.json()["output"]["results"]
    
    def _score(self, support: list, contra: list) -> float:
        s = sum(r.get("score", 0) for r in support)
        c = sum(r.get("score", 0) for r in contra)
        return s / max(s + c, 0.01)
    
    def _verdict(self, conf: float) -> str:
        if conf > 0.8: return "很可能为真"
        elif conf > 0.6: return "可能为真"
        elif conf > 0.4: return "不确定"
        elif conf > 0.2: return "可能为假"
        else: return "很可能为假"

场景三:竞争情报

监控竞争对手最新动态:

class CompetitiveIntelAgent:
    """通过网络搜索追踪竞品动态。"""
    
    def __init__(self, api_key: str):
        self.client = OpenAI(
            base_url="https://api.sandbase.ai/v1",
            api_key=api_key
        )
    
    def monitor_competitor(self, competitor: str, aspects: list[str]) -> dict:
        intel = {}
        for aspect in aspects:
            results = self._search(f"{competitor} {aspect} 2026", freshness="week")
            intel[aspect] = {
                "findings": results[:5],
                "insight": self._summarize(results, competitor, aspect)
            }
        return intel
    
    def _search(self, query: str, freshness: str = "month") -> list[dict]:
        response = self.client.post("/v1/run", body={
            "model": "cloudsway/search",
            "operation": "search",
            "input": {"query": query, "num_results": 10, "freshness": freshness, "include_summary": True}
        })
        return response.json()["output"]["results"]
    
    def _summarize(self, results: list, competitor: str, aspect: str) -> str:
        summaries = "\n".join(f"- {r['summary']}" for r in results[:5] if r.get("summary"))
        response = self.client.chat.completions.create(
            model="openai/gpt-4o-mini",
            messages=[{
                "role": "user",
                "content": f"总结关于{competitor}{aspect}最新信息:\n{summaries}\n\n一段话,聚焦可操作情报。"
            }],
            max_tokens=150
        )
        return response.choices[0].message.content.strip()

# 使用
agent = CompetitiveIntelAgent(api_key="your-key")
intel = agent.monitor_competitor(
    competitor="OpenAI",
    aspects=["产品发布", "定价变动", "合作伙伴", "招聘"]
)

Cloudsway vs Exa:概念对比

两者都在 SandBase 生态中可用,但服务不同目的。更多搜索 API 对比参见社交媒体数据 API 指南最佳 AI 搜索 API

方面Cloudsway SearchExa Search
搜索类型排序网络结果语义内容匹配
最佳查询”AI Agent 框架对比 2026""解释 Agent 如何选择工具的内容”
结果格式标题 + URL + 片段 + 摘要内容 + 高亮 + 相似度分
时效性实时网络取决于爬取频率
广度整个互联网精选高质量内容
Agent 模式研究、监控、核查RAG、内容发现、推荐
类比”Agent 的 Google""Agent 的语义查找器”

集成模式:Cloudsway + RAG

用 Cloudsway 为 RAG 流水线补充实时网络数据:

def augmented_rag_answer(query: str, vector_results: list, api_key: str):
    """结合向量存储结果与实时网络搜索。"""
    client = OpenAI(base_url="https://api.sandbase.ai/v1", api_key=api_key)
    
    # 获取实时网络结果
    web_response = client.post("/v1/run", body={
        "model": "cloudsway/search",
        "operation": "search",
        "input": {"query": query, "num_results": 5, "include_summary": True}
    })
    web_results = web_response.json()["output"]["results"]
    
    # 合并上下文
    internal = "\n".join(f"[内部] {d['content']}" for d in vector_results)
    web = "\n".join(f"[网络: {r['url']}] {r['summary']}" for r in web_results)
    
    # 基于合并上下文生成回答
    response = client.chat.completions.create(
        model="openai/gpt-4o",
        messages=[
            {"role": "system", "content": "结合内部知识和网络来源回答,引用来源。"},
            {"role": "user", "content": f"问题: {query}\n\n内部来源:\n{internal}\n\n网络来源:\n{web}"}
        ]
    )
    return response.choices[0].message.content

定价与用量

Cloudsway Search 通过 SandBase 按次计费:

使用量级预估月成本日查询量
轻量(开发)$5–1510–50
中等(生产 Agent)$30–100100–500
重度(多 Agent 研究)$200–5001000–5000

单次查询成本远低于自建搜索基础设施。无需爬虫、无需索引、无需基础设施运维。

总结

Cloudsway Search 填补了 Agent 工具链中的特定空缺:实时、排序的网络搜索 + 结构化输出。它不是语义搜索或向量数据库的替代品——而是互补。当你的 Agent 需要知道当下正在发生什么、找到权威来源、或基于实时网络验证声明时,使用它。

单一操作的设计使集成极简:一次 API 调用、结构化 JSON 响应、直接供 Agent 消费。结合 SandBase 的统一计费和 API 管理,它自然融入任何多工具 Agent 架构。