HITL Mechanisms within ReAct-based AI Agents #743
LearningGp
started this conversation in
General
Replies: 1 comment
-
|
表格中的AgentScope是AgentScope的python版本还是java版本? Is the AgentScope in the table a python or java version of AgentScope? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
About HITL
As LLM driven agents evolve from simple QA tools into autonomous systems capable of complex reasoning, tool invocation, and long-term planning, "Human-in-the-Loop" (HITL) has ascended from a mere debugging aid to a core architectural element of production-grade systems. In high-stakes domains involving financial trading, enterprise decision-making, and code generation, complete autonomy often carries uncontrollable risks of hallucination and cascading errors. Consequently, constructing efficient, reliable intervention mechanisms aligned with human intent, without compromising Agent autonomy, has become a critical proposition in current Agent framework R&D.
HITL In AI Agents (ReAct)
HITL under the ReAct paradigm differs significantly from HITL in ChatClients or Workflows. In ChatClients, HITL is primarily dialogue-driven and initiated by humans (commands). In Workflows, there are explicit HITL nodes. However, under the ReAct paradigm, since Agents possess autonomous action capabilities, purely dialogue-based intervention is insufficient to meet requirements. Conversely, adding explicit HITL nodes at every step overly restricts the Agent's autonomy. Therefore, this document provides a preliminary survey of HITL practices and theories within the ReAct paradigm.
HITL Classification
Based on reviews of related framework practices and industry implementations, current HITL mechanisms can be categorized into 5 types from a business perspective, and distinguished by "Model-Initiated" vs. "System-Initiated" modes.
Detailed Introduction
Human as Reviewer
Planning/Intent Confirmation
Critical Operation Confirmation
hitl-chat).Human as Collaborator
Information Acquisition/Ambiguity Resolution
UserAgentthat acts as a special sub-agent to interact with the Agent.Manual Collaboration
Model Initiated
UserAgentthat acts as a special sub-agent to interact with the Agent.System Initiated
UserAgentas an Agent node in the orchestration.Human as Commander
User Real-time Intervention
Framework Support Status
Note: AI-generated, currently under manual verification.
S-1: Mechanism support via hooks + interrupt API (ref: hitl-chat).
M-2: Not supported.
M-3: Partial support via UserAgent.
S-2: Mechanism support via interrupt API.
interrupt_before. Allows freezing threads and modifying State ("Time Travel") at any time, perfectly matching the "trajectory correction" requirement.InputRequiredEventto pause workflows; supports global Context control.UserProxyAgent'shuman_input_mode(ALWAYS/TERMINATE). Great for conversational intervention (Class M), but less intuitive than graph frameworks for granular tool interception (S-1).Human In The Loopnode and tool approval toggle (S-1). Logic is linear; difficult to implement complex "Plan-Modify-Retry" loops.human_input=Trueforces the Agent to ask the human before submitting task results (M-1). Lacks low-level interception capability for individual Tool calls.HumanInputRun); S-1 viaHumanApprovalCallback. Lacks graph looping capabilities; S-2 is extremely difficult to implement.AutoFunctionInvocationFilterperfectly implements pre-execution approval for tools (S-1). Model-initiated interaction requires manual Prompt design.ResultValidator.y/nloop. Defaults to intercepting file IO/Shell execution (S-1). Users can correct direction via Feedback after each inference step (S-2).HumanProvideror Code Review stages. Processes are rigid; difficult to intervene in real-time at arbitrary moments.TBD
Is the HITL classification reasonable? Are there missing scenarios or industry implementations?
Does every scenario require a corresponding example, or is relevant documentation sufficient?
Is it necessary to implement built-in information inquiry tools and human intervention confirmation tools, or should they only be presented as examples?
关于 HITL
随着大语言模型(LLM)驱动的智能体(AI Agent)从单一的问答工具向具备复杂推理、工具调用及长期规划能力的自主系统演进,"人机协同"(Human-in-the-Loop, HITL)已从单纯的调试手段跃升为生产级系统的核心架构要素。在涉及金融交易、企业决策、代码生成等高风险领域的应用中,完全的自主性往往伴随着不可控的幻觉风险与级联错误。因此,如何在保持 Agent 自主性的同时,构建高效、可靠且符合人类意图的干预机制,成为当前 Agent 框架研发的关键命题。
关于 HITL In AI Agent(ReAct)
同时 ReAct 范式下的 HITL 也已经与此前 ChatClient 或是 Workflow 下的 HITL 不尽相同。ChatClient 中 HITL 主要通过对话实现,由人类发起命令;在 Workflow 中会有明确的 HITL 节点。而在 ReAct 范式下,由于 Agent 具备了自主行动的能力,只通过对话来干预难以满足需求,在每一个环节增加明确的 HITL 节点又在一定程度上过多地限制了 Agent 的自主性。 因此本文对 ReAct 范式下的 HITL 实践和理论做了初步的调研。
HITL 分类
在查看了一些框架中的相关实践和一些业界分享的实现后,现阶段的 HITL 从业务视角可以分为 5 类,从发起方可以分为模型主动中断以及系统中断。
详细介绍
审核类 (Human as Reviewer)
规划/意图确认
关键操作确认
协作类 (Human as Collaborator)
信息获取/歧义消除
人工协作
模型发起
系统发起
控制类 (Human as Commander)
用户实时干预
框架支持情况
AI 生成,人工确认中
S-1:机制支持,通过 hook 搭配打断 API 实现,参考 hitl-chat。
M-2:不支持。
M-3:部分支持,提供 UserAgent 支持部分实现。
S-2:机制支持,提供打断 API 实现。
interrupt_before。可随时冻结线程、修改 State(实现“时光倒流”),完美契合文档中提到的“纠正运行轨迹”需求。InputRequiredEvent暂停工作流,支持全局 Context 控制。UserProxyAgent的human_input_mode(ALWAYS/TERMINATE) 实现。非常适合对话式介入(M类),但在细粒度工具拦截(S-1)上不如图框架直观。Human In The Loop节点和工具审批开关(S-1)。逻辑较线性,难以实现复杂的“规划-修改-重试”循环。human_input=True后,Agent 在提交任务结果前强制询问人类(M-1)。缺乏对单个 Tool 调用过程的底层拦截能力。HumanInputRun);S-1 通过HumanApprovalCallback实现。缺乏图的循环能力,S-2 极难实现。AutoFunctionInvocationFilter可完美实现工具调用前的审批(S-1)。模型主动交互需在 Prompt 中手动设计。ResultValidator检查最终结果。y/n循环。默认对文件读写/Shell 执行进行拦截(S-1)。用户可在每一步推理后通过 Feedback 纠正方向(S-2)。HumanProvider或 Code Review 环节实现。流程较刚性,难以进行任意时刻的实时干预。TBD
关于 HITL 的分类是否合理,有无遗漏的场景或者业界实现?
每一个场景是否都需要对应的 example,还是只需要相关文档?
是否需要内置信息询问工具以及人类介入确认工具的实现,还是仅作为 example 展示?
REF
https://github.com/HenryPengZou/Awesome-Human-Agent-Collaboration-Interaction-Systems
https://www.elastic.co/search-labs/blog/human-in-the-loop-hitllanggraph-elasticsearch
https://www.reddit.com/r/n8n/comments/1nt8jyj/the_future_of_ai_agents_humanintheloop_is_the/
https://aws.amazon.com/cn/blogs/machine-learning/implement-human-in-the-loop-confirmation-with-amazon-bedrock-agents/
https://gemini.google.com/share/8626f1a62770
https://arxiv.org/html/2505.00753
https://arxiv.org/html/2507.22358v1
https://github.com/bytedance/deer-flow
Beta Was this translation helpful? Give feedback.
All reactions