diff --git a/crates/goose/src/agents/reply_parts.rs b/crates/goose/src/agents/reply_parts.rs index f70f3af48151..ae1e00421058 100644 --- a/crates/goose/src/agents/reply_parts.rs +++ b/crates/goose/src/agents/reply_parts.rs @@ -17,6 +17,7 @@ use crate::providers::toolshim::{ }; use crate::agents::code_execution_extension::EXTENSION_NAME as CODE_EXECUTION_EXTENSION; +use crate::agents::subagent_tool::SUBAGENT_TOOL_NAME; #[cfg(test)] use crate::session::SessionType; use rmcp::model::Tool; @@ -128,7 +129,9 @@ impl Agent { .await; if code_execution_active { let code_exec_prefix = format!("{CODE_EXECUTION_EXTENSION}__"); - tools.retain(|tool| tool.name.starts_with(&code_exec_prefix)); + tools.retain(|tool| { + tool.name.starts_with(&code_exec_prefix) || tool.name == SUBAGENT_TOOL_NAME + }); } // Stable tool ordering is important for multi session prompt caching.