This commit consolidates a large set of host-mode security and UX fixes across backend and frontend. Security / execution model: - Make permission/execution mode switches apply immediately (no deferred pending-only behavior). - Keep runtime mode change notices durable and visible via user-message guidance path. - Add explicit runtime message source taxonomy support and persistence: user / presend / guidance / notify / sub_agent / background_command. - Ensure guidance/notify insertion is batched per tool-cycle so mid-run inserts are committed together. - Separate notify from guidance semantics for mode-change notices. - Add direct-mode auto-fallback handling visibility on frontend. Approval and command gating: - Align run_command approval pre-check logic with docker behavior for approval/auto_approval modes in host execution paths. - Keep approval retry flow and final-result semantics intact when permission errors trigger approval. - Externalize forbidden command keyword list into JSON config: config/forbidden_commands.json. - Update forbidden command rejection message to user-facing wording: 用户不允许执行包含“... ”的指令. Prompt/runtime guidance: - Refine execution-mode runtime rule text to avoid endless workaround loops: one safe alternative first, then request switching to direct mode when truly required. Chat rendering / message UX: - Prevent injected guidance/notify user-messages from incorrectly triggering assistant work header/timer chain. - Restore correct visibility after history reload while preserving runtime-source behavior. - Update user-header icon/label rendering by message source: - guidance -> 引导 + navigation icon - notify/sub_agent/background_command -> 通知 + bell icon - user/presend -> keep normal user header. - Add new icons: static/icons/navigation.svg, static/icons/bell.svg. Approval panel UX: - Convert desktop approval panel from layout-compress sidebar to overlay + blur sheet. - Fix panel transition behavior (remove unintended vertical motion; use dedicated desktop overlay transition). - Improve approval result display: - decision and reason split lines, - green/red status styling, - multiline reason rendering, - auto-collapse delay adjusted to 3s. Execution mode TTL feedback: - When direct mode auto-expires to sandbox, frontend menu state is updated from status snapshot. - Show non-auto-dismiss warning toast to explicitly notify auto-fallback. Misc consistency updates: - Execution mode label text cleanup in composer. - Runtime notice wording normalization (权限模式修改为..., 执行环境修改为...). Build/test notes: - Frontend rebuilt after UI changes. - Smoke tests passed for server refactor path.
36 lines
5.7 KiB
Plaintext
36 lines
5.7 KiB
Plaintext
【翻译前 - 英文原文】
|
|
ReAct: Synergizing Reasoning and Acting in Language Models
|
|
|
|
================================================================================
|
|
1 ABSTRACT
|
|
================================================================================
|
|
While large language models (LLMs) have demonstrated impressive performance across tasks in language understanding and interactive decision making, their abilities for reasoning (e.g. chain-of-thought prompting) and acting (e.g. action plan generation) have primarily been studied as separate topics. In this paper, we explore the use of LLMs to generate both reasoning traces and task-specific actions in an interleaved manner, allowing for greater synergy between the two: reasoning traces help the model induce, track, and update action plans as well as handle exceptions, while actions allow it to interface with and gather additional information from external sources such as knowledge bases or environments.
|
|
|
|
================================================================================
|
|
2 INTRODUCTION
|
|
================================================================================
|
|
A unique feature of human intelligence is the ability to seamlessly combine task-oriented actions with verbal reasoning (or inner speech, Alderson-Day & Fernyhough, 2015), which has been theorized to play an important role in human cognition for enabling self-regulation or strategization (Vygotsky, 1987; Luria, 1965; Fernyhough, 2010) and maintaining a working memory (Baddeley, 1992). Consider the example of cooking up a dish in the kitchen. Between any two specific actions, we may reason in language in order to track progress ("now that everything is cut, I should heat up the pot of water"), to handle exceptions or adjust the plan according to the situation ("I don't have salt, so let me use soy sauce and pepper instead"), and to realize when external information is needed ("how do I prepare dough? Let me search on the Internet").
|
|
|
|
Recent results have hinted at the possibility of combining verbal reasoning with interactive decision making in autonomous systems. On one hand, properly prompted large language models (LLMs) have demonstrated emergent reasoning capabilities to solve complex tasks such as math problems and symbolic reasoning. On the other hand, recent work on LLM-based autonomous agents has enabled decision making in interactive environments such as the web and embodied environments. In this work, we propose ReAct, a general paradigm to combine reasoning and acting with language models for solving diverse language reasoning and decision making tasks.
|
|
|
|
================================================================================
|
|
3 METHOD
|
|
================================================================================
|
|
ReAct Prompting. For HotpotQA and Fever, we randomly select 6 and 3 cases from the training set and manually compose ReAct-format trajectories to use as few-shot exemplars in the prompts. Similar to chain-of-thought, ReAct is a prompting method that coordinates reasoning and actions to solve tasks. The key difference is that the ReAct trajectories contain explicit thoughts that not only plan and decompose goals but also incorporate reasoning about the current state, apply commonsense, and track progress.
|
|
|
|
The format is as follows: Thought 1 -> Action 1 -> Observation 1 -> ... -> Thought N -> Action N. Each thought reasons about the current situation and the next action to take, while each action can be one of the following types: (1) Search[entity], which returns the first k sentences from the corresponding Wikipedia entity page; (2) Lookup[string], which returns the next sentence containing the string in the current passage, simulating the Ctrl+F command on the browser.
|
|
|
|
================================================================================
|
|
4 RELATED WORK
|
|
================================================================================
|
|
The most well-known work of using LLMs for reasoning is Chain-of-Thought (CoT) (Wei et al., 2022), which reveals the ability of LLMs to formulate reasoning steps via few-shot prompting. Subsequent work includes self-consistency (Wang et al., 2022b) for majority voting among multiple reasoning paths and tree-of-thoughts (Yao et al., 2021) for exploring tree search-based reasoning patterns.
|
|
|
|
On the language model for action side, WebGPT (Nakano et al., 2021) uses LLMs to navigate web pages via searching and browsing. SayCan (Ahn et al., 2022) and PaLM-SayCan (Driess et al., 2022) use LLMs for robotic action planning. Inner Monologue (Huang et al., 2022b) uses "inner speech" in embodied environments but combines hard-coded language in pre-defined high-level action primitives. In contrast, ReAct interleaves free-form language reasoning and action in a general manner.
|
|
|
|
================================================================================
|
|
5 CONCLUSIONS
|
|
================================================================================
|
|
We propose ReAct, a simple yet effective method for synergizing reasoning and acting in large language models. Through a diverse set of tasks, we show that ReAct can produce interpretable, high-performing task-solving trajectories, outperforming both action-only and reasoning-only baselines. The interleaved reasoning traces allow the model to dynamically plan, track, and update action plans, while also incorporating reasoning about the external environment.
|
|
|
|
We believe that ReAct provides a promising direction for building more capable and trustworthy LLM agents. Future work includes exploring ReAct on more diverse tasks, investigating the optimal ways to prompt and finetune LLMs with interleaved reasoning and actions, and applying ReAct to other modalities beyond text.
|