Skip to content

Conversation

@tlongwell-block
Copy link
Collaborator

@tlongwell-block tlongwell-block commented Nov 26, 2025

Unifies the subagent tool interface by consolidating three separate tools into one:

  • dynamic_task__create_task (ad-hoc tasks)
  • subrecipe__create_task_* (predefined recipes)
  • subagent__execute_task (execution)

The new subagent tool supports three modes:

  1. Ad-hoc: subagent(instructions: "...")
  2. Predefined: subagent(subrecipe: "name")
  3. Augmented: subagent(subrecipe: "name", instructions: "additional context")

Removes ~2500 lines of code. Updates CI tests and goose-self-test.yaml.

The new augmented mode allows for built in subagent personalities via subrecipes without additional machinery or plumbing. This is a standard feature on other agent platforms. These should be added in a subsequent PR as built in subrecipes much the same way we bundle the system prompts.

@tlongwell-block tlongwell-block changed the title sub/agent/recipe tool unification refactor: unify subagent and subrecipe tools into single tool Nov 26, 2025
@tlongwell-block tlongwell-block marked this pull request as ready for review November 26, 2025 20:08
@lifeizhou-ap
Copy link
Collaborator

Looks good by consolidating the existing tools into one tool!

I noticed that with this PR change we cannot control sequential or parallel execution when the same subrecipe runs multiple times with different parameters inside the parent recipe because sequential_when_repeated is no longer used.

For example, a parent recipe: “use the weather subrecipe to get the weather for Melbourne, Sydney, and Brisbane,” so we call the weather subrecipe three times for each city. Before this PR we can set sequential_when_repeated on subrecipe to run them in sequential if the subrecipe accesses shared resources.

Is there way that we can maintain this behaviour?

@tlongwell-block
Copy link
Collaborator Author

tlongwell-block commented Nov 27, 2025

Looks good by consolidating the existing tools into one tool!

I noticed that with this PR change we cannot control sequential or parallel execution when the same subrecipe runs multiple times with different parameters inside the parent recipe because sequential_when_repeated is no longer used.

For example, a parent recipe: “use the weather subrecipe to get the weather for Melbourne, Sydney, and Brisbane,” so we call the weather subrecipe three times for each city. Before this PR we can set sequential_when_repeated on subrecipe to run them in sequential if the subrecipe accesses shared resources.

Is there way that we can maintain this behaviour?

I'm don't think I understand.

When a recipe is run, there can be multiple subrecipes specified in it. Previously, these were turned into tools that the agent would call at its discretion.

That is also what happens now, just as a parameter instead of a custom tool.

Is there supposed to be a way where the subrecipes execute without being called by the agent? I don't understand what sequential_when_repeated actually does.

Right now, if the agent is told to run subrecipes sequentially, it will just make separate sequential calls to the subagent tool.

@lifeizhou-ap
Copy link
Collaborator

Looks good by consolidating the existing tools into one tool!
I noticed that with this PR change we cannot control sequential or parallel execution when the same subrecipe runs multiple times with different parameters inside the parent recipe because sequential_when_repeated is no longer used.
For example, a parent recipe: “use the weather subrecipe to get the weather for Melbourne, Sydney, and Brisbane,” so we call the weather subrecipe three times for each city. Before this PR we can set sequential_when_repeated on subrecipe to run them in sequential if the subrecipe accesses shared resources.
Is there way that we can maintain this behaviour?

I'm don't think I understand.

When a recipe is run, there can be multiple subrecipes specified in it. Previously, these were turned into tools that the agent would call at its discretion.

That is also what happens now, just as a parameter instead of a custom tool.

Is there supposed to be a way where the subrecipes execute without being called by the agent? I don't understand what sequential_when_repeated actually does.

Right now, if the agent is told to run subrecipes sequentially, it will just make separate sequential calls to the subagent tool.

Hi @tlongwell-block

# multi_city_weather.yaml
version: 1.0.0
title: Multi-City Weather Comparison
description: Compare weather across multiple cities for trip planning
instructions: You are a travel weather specialist helping users compare conditions across cities.
prompt: |
  get the weather forecast for the three biggest cities in Australia 
  to help me decide where to visit
sub_recipes:
- name: weather
  path: "./subrecipes/weather.yaml"
  sequential_when_repeated: true
extensions:
- type: builtin
  name: developer
  timeout: 300
  bundled: true

This is the example. By default, it will run ./subrecipes/weather.yaml with params of Sydney, Melbourne, and Brisbane. This creates 3 tasks and runs in sequential.

Without sequential_when_repeated, these 3 tasks will run in parallel by default. The sequential_when_repeated gives user flexibility if the sub recipe access to some shared resources and avoid issues from concurrent access.

@tlongwell-block
Copy link
Collaborator Author

tlongwell-block commented Nov 29, 2025

Thanks, @lifeizhou-ap! I think I see.

So, before, the subagent/subrecipe tools were special in that a single tool call in a single message could launch many parallel subagents.

Now it's just a regular tool call like any other, which can be done in parallel through the standard tool call mechanism.

With this move to the standard mechanism, there isn't a way to enforce sequential_when_repeated without bigger changes to 'multiple tool calls in a single message' handling.

But, I have put in a dynamic hint to the LLM when a subrecipe has sequential_when_repeated set that it should not be run in parallel. I think this will cover it. Testing shows it works as intended

@alexhancock
Copy link
Collaborator

Would love to see the conflicts resolved here and merged

@tlongwell-block tlongwell-block requested a review from a team as a code owner December 12, 2025 23:44
@tlongwell-block tlongwell-block force-pushed the sub_unification branch 2 times, most recently from 526b93e to 949598e Compare December 12, 2025 23:58
Resolves conflicts from main:
- Deleted files (dynamic_task_tools.rs, sub_recipe_manager.rs,
  subagent_execute_task_tool.rs, dynamic_task_tools_tests.rs) kept deleted
  as intended by PR #5893's unification
- Updated subagent_tool.rs to use new CallToolResult type from main's
  ToolCallResult refactor
@tlongwell-block tlongwell-block merged commit a131b08 into main Dec 13, 2025
18 checks passed
@tlongwell-block tlongwell-block deleted the sub_unification branch December 13, 2025 18:50
michaelneale added a commit that referenced this pull request Dec 15, 2025
* main:
  fix: Make datetime info message more explicit to prevent LLM confusion about current year (#6101)
  refactor: unify subagent and subrecipe tools into single tool (#5893)
  goose repo is too big for the issue solver workflow worker (#6099)
  fix: use system not developer role in db (#6098)
  Add /goose issue solver github workflow (#6068)
  OpenAI responses streaming (#5837)
  Canonical models for Providers (#5694)
  feat: add Inception provider for Mercury models (#6029)
  fix old sessions with tool results not loading (#6094)
  Fix community page mobile responsiveness and horizontal overflow (#6082)
zanesq added a commit that referenced this pull request Dec 15, 2025
* 'main' of github.com:block/goose: (22 commits)
  Disallow subagents with no extensions (#5825)
  chore(deps): bump js-yaml in /documentation (#6093)
  feat: external goosed server (#5978)
  fix: Make datetime info message more explicit to prevent LLM confusion about current year (#6101)
  refactor: unify subagent and subrecipe tools into single tool (#5893)
  goose repo is too big for the issue solver workflow worker (#6099)
  fix: use system not developer role in db (#6098)
  Add /goose issue solver github workflow (#6068)
  OpenAI responses streaming (#5837)
  Canonical models for Providers (#5694)
  feat: add Inception provider for Mercury models (#6029)
  fix old sessions with tool results not loading (#6094)
  Fix community page mobile responsiveness and horizontal overflow (#6082)
  Tool reply meta (#6074)
  chore: avoid accidentally using native tls again (#6086)
  Update vars to be capitalised to be in line with other variables in config file (#6085)
  docs: restructure recipe reference (#5972)
  docs: configure custom providers (#6044)
  docs: Community All-Stars Spotlight November 2025, CodeTV Hackathon edition (#6070)
  fix: include file attachments in queued messages (#5961)
  ...

# Conflicts:
#	crates/goose-server/src/routes/agent.rs
#	crates/goose/src/agents/extension_manager.rs
#	ui/desktop/src/api/sdk.gen.ts
fbalicchia pushed a commit to fbalicchia/goose that referenced this pull request Dec 16, 2025
aharvard added a commit that referenced this pull request Dec 16, 2025
…erer

* origin/main: (26 commits)
  Don't persist ephemeral extensions when resuming sessions (#5974)
  chore(deps): bump mdast-util-to-hast from 13.2.0 to 13.2.1 in /ui/desktop (#5939)
  chore(deps): bump node-forge from 1.3.1 to 1.3.2 in /documentation (#5898)
  Add Scorecard supply-chain security workflow (#5810)
  Don't show subagent tool when we're a subagent (#6125)
  Fix keyboard shortcut conflict for Focus Goose Window (#5809)
  feat(goose-cli): add feature to disable update (#5886)
  workflow: enable docs-update-recipe-ref (#6132)
  fix: filter tools in Ollama streaming when chat mode is enabled (#6118)
  feat(mcp): platform extension for "code mode" MCP tool calling (#6030)
  workflow: auto-update recipe-reference on release (#5988)
  Document recipe slash commands feature (#6075)
  docs: add GitHub Copilot device flow authentication details (#6123)
  Disallow subagents with no extensions (#5825)
  chore(deps): bump js-yaml in /documentation (#6093)
  feat: external goosed server (#5978)
  fix: Make datetime info message more explicit to prevent LLM confusion about current year (#6101)
  refactor: unify subagent and subrecipe tools into single tool (#5893)
  goose repo is too big for the issue solver workflow worker (#6099)
  fix: use system not developer role in db (#6098)
  ...
zanesq added a commit that referenced this pull request Dec 16, 2025
…sions

* 'main' of github.com:block/goose: (22 commits)
  Disallow subagents with no extensions (#5825)
  chore(deps): bump js-yaml in /documentation (#6093)
  feat: external goosed server (#5978)
  fix: Make datetime info message more explicit to prevent LLM confusion about current year (#6101)
  refactor: unify subagent and subrecipe tools into single tool (#5893)
  goose repo is too big for the issue solver workflow worker (#6099)
  fix: use system not developer role in db (#6098)
  Add /goose issue solver github workflow (#6068)
  OpenAI responses streaming (#5837)
  Canonical models for Providers (#5694)
  feat: add Inception provider for Mercury models (#6029)
  fix old sessions with tool results not loading (#6094)
  Fix community page mobile responsiveness and horizontal overflow (#6082)
  Tool reply meta (#6074)
  chore: avoid accidentally using native tls again (#6086)
  Update vars to be capitalised to be in line with other variables in config file (#6085)
  docs: restructure recipe reference (#5972)
  docs: configure custom providers (#6044)
  docs: Community All-Stars Spotlight November 2025, CodeTV Hackathon edition (#6070)
  fix: include file attachments in queued messages (#5961)
  ...

# Conflicts:
#	crates/goose-server/src/routes/agent.rs
#	crates/goose/src/agents/extension_manager.rs
#	ui/desktop/src/api/sdk.gen.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants