feat: Adds max_turns for the agent without user input (#3208)

This commit is contained in:
Jarrod Sibbison
2025-07-03 11:57:25 +10:00
committed by GitHub
parent cf818ada89
commit 2c86a0eb6e
13 changed files with 284 additions and 2 deletions
+1
View File
@@ -45,6 +45,7 @@ pub async fn agent_generator(
max_tool_repetitions: None,
interactive: false, // Benchmarking is non-interactive
scheduled_job_id: None,
max_turns: None,
quiet: false,
sub_recipes: None,
final_output_response: None,
@@ -846,6 +846,11 @@ pub async fn configure_settings_dialog() -> Result<(), Box<dyn Error>> {
"Tool Output",
"Show more or less tool output",
)
.item(
"max_turns",
"Max Turns",
"Set maximum number of turns without user input",
)
.item(
"experiment",
"Toggle Experiment",
@@ -876,6 +881,9 @@ pub async fn configure_settings_dialog() -> Result<(), Box<dyn Error>> {
"tool_output" => {
configure_tool_output_dialog()?;
}
"max_turns" => {
configure_max_turns_dialog()?;
}
"experiment" => {
toggle_experiments_dialog()?;
}
@@ -1289,3 +1297,35 @@ fn configure_scheduler_dialog() -> Result<(), Box<dyn Error>> {
Ok(())
}
pub fn configure_max_turns_dialog() -> Result<(), Box<dyn Error>> {
let config = Config::global();
let current_max_turns: u32 = config.get_param("GOOSE_MAX_TURNS").unwrap_or(1000);
let max_turns_input: String =
cliclack::input("Set maximum number of agent turns without user input:")
.placeholder(&current_max_turns.to_string())
.default_input(&current_max_turns.to_string())
.validate(|input: &String| match input.parse::<u32>() {
Ok(value) => {
if value < 1 {
Err("Value must be at least 1")
} else {
Ok(())
}
}
Err(_) => Err("Please enter a valid number"),
})
.interact()?;
let max_turns: u32 = max_turns_input.parse()?;
config.set_param("GOOSE_MAX_TURNS", Value::from(max_turns))?;
cliclack::outro(format!(
"Set maximum turns to {} - Goose will ask for input after {} consecutive actions",
max_turns, max_turns
))?;
Ok(())
}
+1
View File
@@ -483,6 +483,7 @@ async fn process_message_streaming(
working_dir: std::env::current_dir()?,
schedule_id: None,
execution_mode: None,
max_turns: None,
};
// Get response from agent