agentscope-ai / agentscope-ai/agentscope-java

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

Đang mở
#1,955 1 bình luận 0 reaction 0 người được giao Xem trên GitHub
area/ext/rag enhancement
Ngôn ngữ chính
Java
Star
5.6k
Fork
1.3k
Merge trung bình
4 ngày 12 giờ
Pull request đã merge (30 ngày)
77

Mô tả

**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.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.