Minimally disable subagents when not in autonomous model (#5149)
This commit is contained in:
@@ -113,6 +113,12 @@ impl PromptManager {
|
|||||||
Value::String(suggest_disable_extensions_prompt.to_string()),
|
Value::String(suggest_disable_extensions_prompt.to_string()),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Add the mode to the context for conditional rendering
|
||||||
|
let config = Config::global();
|
||||||
|
let goose_mode = config.get_param("GOOSE_MODE").unwrap_or("auto".to_string());
|
||||||
|
context.insert("goose_mode", Value::String(goose_mode.clone()));
|
||||||
|
context.insert("is_autonomous", Value::Bool(goose_mode == "auto"));
|
||||||
|
|
||||||
// First check the global store, and only if it's not available, fall back to the provided model_name
|
// First check the global store, and only if it's not available, fall back to the provided model_name
|
||||||
let model_to_use: Option<String> =
|
let model_to_use: Option<String> =
|
||||||
get_current_model().or_else(|| model_name.map(|s| s.to_string()));
|
get_current_model().or_else(|| model_name.map(|s| s.to_string()));
|
||||||
@@ -139,8 +145,6 @@ impl PromptManager {
|
|||||||
};
|
};
|
||||||
|
|
||||||
let mut system_prompt_extras = self.system_prompt_extras.clone();
|
let mut system_prompt_extras = self.system_prompt_extras.clone();
|
||||||
let config = Config::global();
|
|
||||||
let goose_mode = config.get_param("GOOSE_MODE").unwrap_or("auto".to_string());
|
|
||||||
if goose_mode == "chat" {
|
if goose_mode == "chat" {
|
||||||
system_prompt_extras.push(
|
system_prompt_extras.push(
|
||||||
"Right now you are in the chat only mode, no access to any tool use and system."
|
"Right now you are in the chat only mode, no access to any tool use and system."
|
||||||
|
|||||||
@@ -40,9 +40,20 @@ impl Agent {
|
|||||||
// Get tools from extension manager
|
// Get tools from extension manager
|
||||||
let mut tools = self.list_tools_for_router().await;
|
let mut tools = self.list_tools_for_router().await;
|
||||||
|
|
||||||
|
let config = crate::config::Config::global();
|
||||||
|
let is_autonomous = config.get_param("GOOSE_MODE").unwrap_or("auto".to_string()) == "auto";
|
||||||
|
|
||||||
// If router is disabled and no tools were returned, fall back to regular tools
|
// If router is disabled and no tools were returned, fall back to regular tools
|
||||||
if !router_enabled && tools.is_empty() {
|
if !router_enabled && tools.is_empty() {
|
||||||
|
// Get all tools but filter out subagent tools if not in autonomous mode
|
||||||
tools = self.list_tools(None).await;
|
tools = self.list_tools(None).await;
|
||||||
|
if !is_autonomous {
|
||||||
|
// Filter out subagent-related tools
|
||||||
|
tools.retain(|tool| {
|
||||||
|
tool.name != crate::agents::subagent_execution_tool::subagent_execute_task_tool::SUBAGENT_EXECUTE_TASK_TOOL_NAME
|
||||||
|
&& tool.name != crate::agents::recipe_tools::dynamic_task_tools::DYNAMIC_TASK_TOOL_NAME_PREFIX
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add frontend tools
|
// Add frontend tools
|
||||||
|
|||||||
@@ -62,8 +62,8 @@ impl TodoClient {
|
|||||||
- [ ] Implement feature X
|
- [ ] Implement feature X
|
||||||
- [ ] Update API
|
- [ ] Update API
|
||||||
- [ ] Write tests
|
- [ ] Write tests
|
||||||
- [ ] Run tests (subagent in parallel)
|
- [ ] Run tests
|
||||||
- [ ] Run lint (subagent in parallel)
|
- [ ] Run lint
|
||||||
- [ ] Blocked: waiting on credentials
|
- [ ] Blocked: waiting on credentials
|
||||||
"#}.to_string()),
|
"#}.to_string()),
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ No extensions are defined. You should let the user know that they should add ext
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{{tool_selection_strategy}}
|
{{tool_selection_strategy}}
|
||||||
|
{% if is_autonomous %}
|
||||||
# sub agents
|
# sub agents
|
||||||
|
|
||||||
Execute self contained tasks where step-by-step visibility is not important through subagents.
|
Execute self contained tasks where step-by-step visibility is not important through subagents.
|
||||||
@@ -60,6 +60,7 @@ Execute self contained tasks where step-by-step visibility is not important thro
|
|||||||
- Provide all needed context — subagents cannot see your context
|
- Provide all needed context — subagents cannot see your context
|
||||||
- Use extension filters to limit resource access
|
- Use extension filters to limit resource access
|
||||||
- Use return_last_only when only a summary or simple answer is required — inform subagent of this choice.
|
- Use return_last_only when only a summary or simple answer is required — inform subagent of this choice.
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
# Response Guidelines
|
# Response Guidelines
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user