Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 0 additions & 14 deletions crates/goose/src/agents/agent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1057,18 +1057,6 @@ impl Agent {
extension_configs
}

pub(crate) async fn total_extension_and_tool_counts(&self, session_id: &str) -> (usize, usize) {
let (extension_count, tool_count) = self
.extension_manager
.get_extension_and_tool_counts(session_id)
.await;

(
extension_count + self.frontend_extensions.lock().await.len(),
tool_count + self.frontend_tools.lock().await.len(),
)
}

pub async fn add_final_output_tool(&self, response: Response) {
let mut final_output_tool = self.final_output_tool.lock().await;
let created_final_output_tool = FinalOutputTool::new(response);
Expand Down Expand Up @@ -3711,7 +3699,6 @@ impl Agent {
.get_extensions_info(&session.working_dir)
.await;
tracing::debug!("Retrieved {} extensions info", extensions_info.len());
let (extension_count, tool_count) = self.total_extension_and_tool_counts(session_id).await;

let model_config = self.model_config_for_session(session_id).await?;
let model_name = &model_config.model_name;
Expand All @@ -3723,7 +3710,6 @@ impl Agent {
.builder()
.with_extensions(extensions_info.into_iter())
.with_frontend_instructions(self.frontend_instructions.lock().await.clone())
.with_extension_and_tool_counts(extension_count, tool_count)
.with_goose_mode(goose_mode)
.build();

Expand Down
12 changes: 0 additions & 12 deletions crates/goose/src/agents/extension_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1291,18 +1291,6 @@ impl ExtensionManager {
}
}

pub async fn get_extension_and_tool_counts(&self, session_id: &str) -> (usize, usize) {
let enabled_extensions_count = self.extensions.lock().await.len();

let total_tools = self
.get_prefixed_tools(session_id, None)
.await
.map(|tools| tools.len())
.unwrap_or(0);

(enabled_extensions_count, total_tools)
}

pub async fn list_extensions(&self) -> ExtensionResult<Vec<String>> {
Ok(self.extensions.lock().await.keys().cloned().collect())
}
Expand Down
26 changes: 0 additions & 26 deletions crates/goose/src/agents/prompt_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ use crate::{
};
use std::path::Path;

const MAX_EXTENSIONS: usize = 5;
const MAX_TOOLS: usize = 50;

pub struct PromptManager {
system_prompt_override: Option<String>,
system_prompt_extras: IndexMap<String, String>,
Expand All @@ -36,13 +33,9 @@ impl Default for PromptManager {
struct SystemPromptContext {
extensions: Vec<ExtensionInfo>,
current_date_time: String,
#[serde(skip_serializing_if = "Option::is_none")]
extension_tool_limits: Option<(usize, usize)>,
goose_mode: GooseMode,
is_autonomous: bool,
enable_subagents: bool,
max_extensions: usize,
max_tools: usize,
code_execution_mode: bool,
include_extensions: bool,
#[serde(skip_serializing_if = "Option::is_none")]
Expand All @@ -55,7 +48,6 @@ pub struct SystemPromptBuilder<'a, M> {
extensions_info: Vec<ExtensionInfo>,
frontend_instructions: Option<String>,
prompt_extras: IndexMap<String, String>,
extension_tool_count: Option<(usize, usize)>,
subagents_enabled: bool,
hints: Option<String>,
code_execution_mode: bool,
Expand Down Expand Up @@ -89,15 +81,6 @@ impl<'a> SystemPromptBuilder<'a, PromptManager> {
self
}

pub fn with_extension_and_tool_counts(
mut self,
extension_count: usize,
tool_count: usize,
) -> Self {
self.extension_tool_count = Some((extension_count, tool_count));
self
}

pub fn with_code_execution_mode(mut self, enabled: bool) -> Self {
self.code_execution_mode = enabled;
self
Expand Down Expand Up @@ -156,19 +139,12 @@ impl<'a> SystemPromptBuilder<'a, PromptManager> {
.goose_mode
.unwrap_or_else(|| Config::global().get_goose_mode().unwrap_or_default());

let extension_tool_limits = self
.extension_tool_count
.filter(|(extensions, tools)| *extensions > MAX_EXTENSIONS || *tools > MAX_TOOLS);

let context = SystemPromptContext {
extensions: sanitized_extensions_info,
current_date_time: self.manager.current_date_timestamp.clone(),
extension_tool_limits,
goose_mode,
is_autonomous: goose_mode == GooseMode::Auto,
enable_subagents: self.subagents_enabled,
max_extensions: MAX_EXTENSIONS,
max_tools: MAX_TOOLS,
code_execution_mode: self.code_execution_mode,
include_extensions: self.include_extensions,
moim_system_prompt_block: moim::system_prompt_block(),
Expand Down Expand Up @@ -298,7 +274,6 @@ impl PromptManager {
extensions_info: vec![],
frontend_instructions: None,
prompt_extras: IndexMap::new(),
extension_tool_count: None,
subagents_enabled: false,
hints: None,
code_execution_mode: false,
Expand Down Expand Up @@ -514,7 +489,6 @@ mod tests {
"<instructions on how to use extension B (no resources)>",
false,
))
.with_extension_and_tool_counts(MAX_EXTENSIONS + 1, MAX_TOOLS + 1)
.build();

assert_snapshot!(system_prompt)
Expand Down
3 changes: 0 additions & 3 deletions crates/goose/src/agents/reply_parts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,6 @@ impl Agent {
.extension_manager
.get_extensions_info(working_dir)
.await;
let (extension_count, tool_count) = self.total_extension_and_tool_counts(session_id).await;

let model_config = self.model_config_for_session(session_id).await?;

let goose_mode = *self.current_goose_mode.lock().await;
Expand All @@ -220,7 +218,6 @@ impl Agent {
.builder()
.with_extensions(extensions_info.into_iter())
.with_frontend_instructions(self.frontend_instructions.lock().await.clone())
.with_extension_and_tool_counts(extension_count, tool_count)
.with_code_execution_mode(code_execution_active)
.with_hints(working_dir)
.with_goose_mode(goose_mode)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,6 @@ Template:




# Response Guidelines

Use Markdown formatting for all responses.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
source: crates/goose/src/agents/prompt_manager.rs
assertion_line: 457
expression: system_prompt
---
You are a general-purpose AI agent called goose, created by AAIF (Agentic AI Foundation).
Expand Down Expand Up @@ -30,7 +31,6 @@ You can dynamically enable or disable extensions as needed to help complete task

No extensions are defined. You should let the user know that they should add extensions.


# Response Guidelines

Use Markdown formatting for all responses.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
source: crates/goose/src/agents/prompt_manager.rs
assertion_line: 473
expression: system_prompt
---
You are a general-purpose AI agent called goose, created by AAIF (Agentic AI Foundation).
Expand Down Expand Up @@ -40,7 +41,6 @@ test supports resources.
### Instructions
how to use this extension


# Response Guidelines

Use Markdown formatting for all responses.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
source: crates/goose/src/agents/prompt_manager.rs
assertion_line: 494
expression: system_prompt
---
You are a general-purpose AI agent called goose, created by AAIF (Agentic AI Foundation).
Expand Down Expand Up @@ -44,11 +45,6 @@ extension_A supports resources.
### Instructions
<instructions on how to use extension B (no resources)>

# Suggestion

The user has 6 extensions with 51 tools enabled, exceeding recommended limits (5 extensions or 50 tools).
Consider asking if they'd like to disable some extensions to improve tool selection accuracy.

# Response Guidelines

Use Markdown formatting for all responses.
9 changes: 0 additions & 9 deletions crates/goose/src/prompts/system.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,6 @@ No extensions are defined. You should let the user know that they should add ext
{% endif %}
{% endif %}

{% if include_extensions and extension_tool_limits is defined and not code_execution_mode %}
{% with (extension_count, tool_count) = extension_tool_limits %}
# Suggestion

The user has {{extension_count}} extensions with {{tool_count}} tools enabled, exceeding recommended limits ({{max_extensions}} extensions or {{max_tools}} tools).
Consider asking if they'd like to disable some extensions to improve tool selection accuracy.
{% endwith %}
{% endif %}

# Response Guidelines

Use Markdown formatting for all responses.