goose icon indicating copy to clipboard operation
goose copied to clipboard

Unify subrecipe and subagent execution through shared recipe pipeline

Open tlongwell-block opened this issue 2 months ago • 3 comments

Replaces subprocess-based subrecipe execution with in-process transformation, unifying the execution path between subrecipes and subagents while bringing full Recipe feature support to subagents.

What Changed

  • Subrecipes now execute in-process instead of spawning goose run --recipe
  • Removed TaskType enum - both subrecipes and inline recipes are just recipes
  • Unified execution through single run_complete_subagent_task() path
  • Added ModelOverrideProvider for recipe-specific model configuration

Backend Changes for Subrecipes

Subrecipes previously spawned a subprocess (goose run --recipe) which naturally supported all Recipe features. Now they:

  • Load and build recipes directly at task creation time
  • Execute through the same in-process pipeline as subagents
  • Eliminate 170+ lines of subprocess management code
  • Run faster without process overhead

New Capabilities for Subagents

Subagents (inline recipes) now support the full Recipe specification:

  • Recipe context (initial conversation messages)
  • Recipe activities (execution logging)
  • Recipe retry configuration
  • Recipe response schemas with FinalOutputTool validation
  • Recipe settings for provider/model overrides

Implementation Details

Both subrecipes and subagents now flow through the same execution path. At task creation, subrecipes are loaded and transformed into Recipe objects, making them indistinguishable from inline recipes during execution. The ModelOverrideProvider enables recipe-specific settings without creating new provider instances.

This moves toward the unified execution model outlined in #4389, where all agent work flows through consistent pipelines regardless of entry point.

tlongwell-block avatar Oct 08 '25 20:10 tlongwell-block

@yingjiehe-xyz can you do a first pass as you touched this last

DOsinga avatar Oct 11 '25 15:10 DOsinga

@lifeizhou-ap can you check out the subrecipe changes here?

tlongwell-block avatar Oct 16 '25 14:10 tlongwell-block

Hi @tlongwell-block,

Thanks for removing cli code for running subrecipe! I've added a couple of comments regarding the sub-recipe behaviour. Also please test with the subrecipe features in CLI and Desktop to check the behaviours and the output. Thank you!

lifeizhou-ap avatar Oct 16 '25 23:10 lifeizhou-ap