From 6f301789b7ceaceea59ffda260dd22b8299aa832 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=86=AF=E5=9F=BA=E9=AD=81?= <56265583+fengjikui@users.noreply.github.com> Date: Mon, 8 Jun 2026 07:50:36 +0800 Subject: [PATCH] fix(agents): proxy human input flag through executor state --- lib/crewai/src/crewai/experimental/agent_executor.py | 10 ++++++++++ lib/crewai/tests/agents/test_agent_executor.py | 12 ++++++++++++ 2 files changed, 22 insertions(+) diff --git a/lib/crewai/src/crewai/experimental/agent_executor.py b/lib/crewai/src/crewai/experimental/agent_executor.py index 3cc9cdd7be..a1ab22a3c1 100644 --- a/lib/crewai/src/crewai/experimental/agent_executor.py +++ b/lib/crewai/src/crewai/experimental/agent_executor.py @@ -279,6 +279,16 @@ def messages(self, value: list[LLMMessage]) -> None: """Set state messages.""" self._state.messages = value + @property # type: ignore[misc] + def ask_for_human_input(self) -> bool: + """Compatibility property - returns human-input state flag.""" + return bool(self._state.ask_for_human_input) + + @ask_for_human_input.setter + def ask_for_human_input(self, value: bool) -> None: + """Set human-input state flag.""" + self._state.ask_for_human_input = value + @start() def generate_plan(self) -> None: """Generate execution plan if planning is enabled. diff --git a/lib/crewai/tests/agents/test_agent_executor.py b/lib/crewai/tests/agents/test_agent_executor.py index 5868a7ce2e..3cf3a1e680 100644 --- a/lib/crewai/tests/agents/test_agent_executor.py +++ b/lib/crewai/tests/agents/test_agent_executor.py @@ -220,6 +220,18 @@ def test_executor_initialization(self, mock_dependencies): assert executor.max_iter == 10 assert executor.use_stop_words is True + def test_ask_for_human_input_proxies_state(self, mock_dependencies): + """Human-input providers should access the executor flag directly.""" + executor = _build_executor(**mock_dependencies) + + executor.ask_for_human_input = True + assert executor.state.ask_for_human_input is True + assert executor.ask_for_human_input is True + + executor.ask_for_human_input = False + assert executor.state.ask_for_human_input is False + assert executor.ask_for_human_input is False + def test_initialize_reasoning(self, mock_dependencies): """Test flow entry point.""" with patch.object(