Skip to content

AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.

Disable `ask_user` for testing or benchmarking runs

Reinier van der Leer055bbc10d480
diff --git a/agbenchmark/benchmarks.py b/agbenchmark/benchmarks.py
index ff8ab87742..bf5ff2567f 100644
--- a/agbenchmark/benchmarks.py
+++ b/agbenchmark/benchmarks.py
@@ -25,6 +25,7 @@ def bootstrap_agent(task: str, continuous_mode: bool) -> Agent:
config.debug_mode = True
config.continuous_mode = continuous_mode
config.temperature = 0
+ config.noninteractive_mode = True
config.plain_output = True
config.memory_backend = "no_memory"
config.workspace_path = Workspace.init_workspace_directory(config)
diff --git a/autogpt/commands/user_interaction.py b/autogpt/commands/user_interaction.py
index d5fa38db42..484150fb50 100644
--- a/autogpt/commands/user_interaction.py
+++ b/autogpt/commands/user_interaction.py
@@ -23,6 +23,7 @@ from autogpt.command_decorator import command
"required": True,
}
},
+ enabled=lambda config: not config.noninteractive_mode
)
def ask_user(question: str, agent: Agent) -> str:
resp = clean_input(agent.config, f"{agent.ai_config.ai_name} asks: '{question}': ")
diff --git a/autogpt/config/config.py b/autogpt/config/config.py
index 93fc42e914..f47c22c37b 100644
--- a/autogpt/config/config.py
+++ b/autogpt/config/config.py
@@ -37,6 +37,7 @@ class Config(SystemSettings, arbitrary_types_allowed=True):
exit_key: str = "n"
debug_mode: bool = False
plain_output: bool = False
+ noninteractive_mode: bool = False
chat_messages_enabled: bool = True
# TTS configuration
speak_mode: bool = False
diff --git a/tests/conftest.py b/tests/conftest.py
index 55a1a4e3fa..0631ee50f1 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -57,6 +57,7 @@ def config(
config.plugins_dir = "tests/unit/data/test_plugins"
config.plugins_config_file = temp_plugins_config_file
+ config.noninteractive_mode = True
config.plain_output = True
# avoid circular dependency