Skip to content

feat: add pluggable research provider interface and open-webSearch adapter - #323

Open
foreverlyl-l wants to merge 3 commits into
Narcooo:masterfrom
foreverlyl-l:research-provider-v1.6
Open

feat: add pluggable research provider interface and open-webSearch adapter#323
foreverlyl-l wants to merge 3 commits into
Narcooo:masterfrom
foreverlyl-l:research-provider-v1.6

Conversation

@foreverlyl-l

Copy link
Copy Markdown

Summary

  • 引入了统一的 ResearchProvider 调研接口:为调研提供最小化的 searchfetch 行为契约,解耦具体的搜索引擎与调研 Agent 逻辑。
  • 添加了 OpenWebSearchProvider 适配器:可通过对接https://github.com/Aas-ee/open-webSearch ,为调研 Agent 提供本地的网络检索和网页解析能力。
  • Researcher 中支持外部 Provider 注入:更新了 runResearchReport 依赖项(ResearchDeps),使其能动态解析并使用传入的 ResearchProvider

Type of change

  • Bug fix
  • New feature
  • Refactor (no behavior change)
  • Docs / SKILL.md
  • Test
  • Performance

Motivation (optional)

为了增强调研 Agent 的检索灵活性,使系统能够摆脱对特定默认网络检索工具的依赖。引入该通用 Provider 接口后,开发者可以很方便地扩展并切换到其他搜索引擎服务商(如 open-websearch 实例)。

Changes

File Change
provider.ts [NEW] 定义了核心的 ResearchProvider 抽象接口,包含 id, searchfetch 声明。
open-websearch-provider.ts [NEW] 实现了基于本地 open-websearch HTTP 服务端适配的 OpenWebSearchProvider,支持 /search/fetch-web 接口调用。
open-websearch-provider.test.ts [NEW]OpenWebSearchProvider 的各个场景(正常搜索、网页抓取、超时控制及异常处理)进行单元测试覆盖。
researcher.ts [MODIFY]ResearchProvider 集成入 ResearchDeps,并在执行调研任务时动态绑定和使用它的 search/fetch 方法。
index.ts [MODIFY] 在 package 出口向外暴露新增的 Provider 类型和错误类,方便外部集成和调用。

Usage (optional)

通过以下示例代码,可以在调用 runResearchReport 时注入并使用本地的 open-websearch 检索实例:

import { OpenWebSearchProvider, runResearchReport } from "@actalk/inkos-core";

// 实例化 OpenWebSearch 服务商适配器
const provider = new OpenWebSearchProvider({
  endpoint: "http://127.0.0.1:3210",
  timeoutMs: 5000,
});

// 在依赖中注入 provider 执行调研
const report = await runResearchReport(
  {
    topic: "AI Agent Design Patterns",
    purpose: "general",
    depth: "quick",
  },
  { provider }
);

@foreverlyl-l foreverlyl-l changed the title Research provider v1.6 feat: add pluggable research provider interface and open-webSearch adapter Jul 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant