need to enable the subagent tool whenever subrecipes are specified

This commit is contained in:
Tyler Longwell
2025-12-18 14:52:51 -05:00
parent b08a336335
commit eef0d0fe06
3 changed files with 15 additions and 2 deletions
+2
View File
@@ -497,6 +497,8 @@ pub async fn build_session(session_config: SessionBuilderConfig) -> CliSession {
}
}
agent_ptr.ensure_subagent_for_recipes().await;
// Determine editor mode
let edit_mode = config
.get_param::<String>("EDIT_MODE")
@@ -170,6 +170,8 @@ pub async fn apply_recipe_to_agent(
)
.await;
agent.ensure_subagent_for_recipes().await;
recipe.instructions.as_ref().map(|instructions| {
let mut context: HashMap<&str, Value> = HashMap::new();
context.insert("recipe_instructions", Value::String(instructions.clone()));
+11 -2
View File
@@ -407,8 +407,8 @@ impl Agent {
response: Option<Response>,
include_final_output: bool,
) {
if let Some(sub_recipes) = sub_recipes {
self.add_sub_recipes(sub_recipes).await;
if let Some(ref sub_recipes) = sub_recipes {
self.add_sub_recipes(sub_recipes.clone()).await;
}
if include_final_output {
@@ -418,6 +418,15 @@ impl Agent {
}
}
pub async fn ensure_subagent_for_recipes(&self) {
let has_sub_recipes = !self.sub_recipes.read().await.is_empty();
if has_sub_recipes {
if let Err(e) = self.enable_subagent_extension().await {
warn!("Failed to enable subagent extension for recipe: {}", e);
}
}
}
/// Dispatch a single tool call to the appropriate client
#[instrument(skip(self, tool_call, request_id), fields(input, output))]
pub async fn dispatch_tool_call(