agentscope-ai / agentscope-ai/QwenPaw

[Feature]: 新增 ask_user_question 工具,支持 Human-in-the-Loop

オープン
#6,274 コメント 1 件 リアクション 1 件 担当者 0 名 GitHub で見る
enhancement
主要言語
Python
スター
34.9k
フォーク
3.1k
平均マージ
1日 15時間
マージ済み PR(30日)
225

説明

## Summary

建议在官方 Agent 工具集中新增 `ask_user_question` 工具,用于 Human-in-the-Loop 场景:当 Agent 遇到模糊或高风险请求时,暂停执行并向用户抛出结构化多选题(带"其他 / 自定义输入"兜底),再带着答复恢复任务,避免自行猜测或直接产生副作用。

## Component(s) Affected

- [x] Core / Backend (app, agents, config, providers, utils, local_models)
- [x] Console (frontend web UI)
- [ ] Channels (DingTalk, Feishu, QQ, Discord, iMessage, etc.)
- [ ] Skills
- [ ] CLI
- [ ] Documentation (website)
- [ ] Tests
- [ ] CI/CD
- [ ] Scripts / Deploy

## Problem / Motivation

当用户请求模糊时(如"重构 auth 模块"、"新建一个 skill"、"修一下失败的测试"),Agent 现在只能:

- 自行猜测一个默认值继续执行 —— 容易反复返工,甚至产生不可逆副作用;
- 在普通文本里口头反问一句 —— 结果非结构化,下游 Skill / 插件难以可靠分支,模型还经常"自己接上"答完。

主流 IDE 集成的 Agent 都内置了类似工具用于 Human-in-the-Loop:Claude Code 的 `AskUserQuestion`、Cursor Agent 的结构化澄清、GitHub Copilot Chat 的澄清提示、Gemini CLI 的 `ask_user`、Codex CLI 的 request-for-input。这是"防止 Agent 猜错"的关键 UX 改进。QwenPaw 目前缺少这一工具。

## Proposed Solution

新增官方内置工具 `ask_user_question`:

- 入参:1–4 个问题,每个问题 2–4 个互斥选项(label + description),隐含 "Other" 自由输入兜底。
- 行为:调用时 Agent 运行时**挂起**当前步骤并保留上下文 → UI 渲染交互卡片 → 用户点击选项或输入自定义答案 → 运行时**恢复**原步骤,将用户选择作为结构化返回值继续。
- 优先在 Console Web UI 落地,后续再覆盖 CLI / TUI 与部分 Channel。

## Alternatives Considered

[Any other approaches or workarounds you thought about.]

## Additional Context

[Screenshots, examples, links to docs or similar features elsewhere.]

## Willing to Contribute

- [x] I am willing to open a PR for this feature (after discussion).

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。