agentscope-ai / agentscope-ai/agentscope-java

[Feature]: Provide built-in RAG retrieval tool for v2

未关闭
#1,955 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
area/ext/rag enhancement
主要语言
Java
星标
5.6k
派生
1.3k
平均合并
4 天 12 小时
30 天内合并 PR
77

描述

**AgentScope-Java is an open-source project. To involve a broader community, we recommend asking your questions in English.**

**Is your feature request related to a problem? Please describe.**
AgentScope Java v2 deprecated the core RAG package without a built-in replacement. Developers must build their own embedding, vector storage, and retrieval pipeline from scratch. Knowledge-intensive scenarios force every v2 project to reinvent the wheel.

**Describe the solution you'd like**
A built-in `KnowledgeSearchTool` in `agentscope-core`, following the same pattern as existing
built-in tools like `reset_tools` (MetaTool) and `TodoTools`. It is opt-in — not activated by default.

```java
// Default: no RAG tool, behavior unchanged
ReActAgent agent = ReActAgent.builder().build();

// Opt in: register with a knowledge adapter
toolkit.registration()
.tool(new KnowledgeSearchTool(new BailianRagAdapter(apiKey)))
.apply();
```

The tool follows the standard ToolBase contract and works with ToolGroup, Skills,
PermissionSystem, and all other v2 building blocks out of the box.

**Describe alternatives you've considered**
1. Every developer DIY: Duplicated effort, inconsistent APIs across projects.
2. Middleware auto-injection: Automatically injects retrieved context before every
reasoning step. Useful for "must-lookup" scenarios like terminology translation,
but adds overhead when retrieval is unnecessary. Can be added later if needed.
3. Skill-based orchestration: SKILL.md orchestrates the retrieval workflow.
But Skills depend on tools existing first, so the Tool must come first.
Tool-first is the minimal, composable building block.

**Additional context**
RAG is essential for production scenarios:
- Terminology databases (100k+ entries can't fit in a prompt)
- Historical translation memory (1000+ past translations)
- Domain-specific document Q&A
This follows the same "opt-in built-in" pattern as other v2 tools (MetaTool, TodoTools).
Developers who don't need RAG see zero overhead — Agent behavior stays exactly the same.

I'm willing to implement this feature and submit a PR. If the maintainers agree with this direction, please assign the issue to me and I'll start working on it.

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。