Skip to content

Conversation

@wendytang
Copy link
Contributor

  • allow a maximum of 5 subagent loops
  • kept fairly small number of loops for now to ensure subagent tasks complete.
  • interesting problem to think about: depending on complexity of subagent tasks, size up or down # agent loop permitted

@wendytang wendytang marked this pull request as ready for review July 23, 2025 00:58
@wendytang wendytang requested review from jamadeo and lifeizhou-ap and removed request for jamadeo July 23, 2025 01:00
@lifeizhou-ap
Copy link
Collaborator

Hi @wendytang ,

While reviewing this PR, I feel the subagent has part of the agent(agent.rs) reply() logic but not all. in the agent we have max turn logic, final result and retry logic. These are the logic that we would also to have in the subagent. Just wondering whether it is possible to refactor the code to reuse the agent reply? so that we don't have to duplicate the logic every time when we have a new feature in agent

.as_ref()
.ok_or_else(|| anyhow!("No extension manager configured for subagent"))?;

// Check if we've exceeded max turns
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

independent of this, is there a plan to unify this subagent loop with the main agent loop? already I feel l like we're starting to see code drift between the two approaches

@wendytang
Copy link
Contributor Author

I agree that we should unify subagent -> simply use agent reply().

Dug into this a bit, and it boils down to the reply method's return type. It reaches the upper limits of my rust knowledge for now, but I do believe this is possible.

The error occurs because you're trying to call child_agent.reply() within the Agent::reply() method, but the future returned by reply() is not Send. This is a common Rust async issue related to thread safety.
Looking at the reply() method signature on line 876:

pub async fn reply(
    &self,
    messages: &[Message],
    session: Option<SessionConfig>,
    cancel_token: Option<CancellationToken>,
) -> Result<BoxStream<'_, Result<AgentEvent>>> {

@wendytang wendytang merged commit 64d311c into main Jul 23, 2025
8 checks passed
@wendytang wendytang deleted the wtang/subagent_minimal branch July 23, 2025 21:13
taylorkmho added a commit that referenced this pull request Jul 23, 2025
* main:
  feat: subagent turn count, simple agent loop (#3597)
  feat: subagent independent extension manager (#3596)
  Improve session history loading resiliency (#3588)
  Added logging and changed default route case to not redirect to home when there is an invalid route (#3610)
  fix: chat sidebar layout overlapping content occasionally (#3590)
  fix: loading shared sessions (#3607)
  docs: use installer component for tutorial, add updating extensions section (#3608)
  fix: show token alert popover during agent responses and agent failure cases (#3536)
  reuse the cancellation token in the agent level (#3599)
  Docs: Move MongoDB tutorial to MCP section (#3602)
  docs: desktop recipe format (#3594)
  Fix model display name not being updated immediately after leaving settings (#3587)
  Added option to summarize the chat when an error is triggered (#3598)
  Remove mcp_macros and unused types (#3581)
  fix: add fallback id to messages if none provided (#3584)
  feat: migrate ErrorData from internal mcp crates to rmcp version (#3586)
  fix: adjust subrecipe description to allow running tests (#3585)
  Scenario tests (#3430)
  feat: migrate JsonRpcMessage/Request/Response/Error/Notification from internal mcp crates to rmcp versions (#3564)
  Restore recipe parameters functionality (#3530)
lifeizhou-ap added a commit that referenced this pull request Jul 24, 2025
* main: (28 commits)
  fix: multi-tool calls in streamed openai-compatible responses (#3609)
  feat: subagent turn count, simple agent loop (#3597)
  feat: subagent independent extension manager (#3596)
  Improve session history loading resiliency (#3588)
  Added logging and changed default route case to not redirect to home when there is an invalid route (#3610)
  fix: chat sidebar layout overlapping content occasionally (#3590)
  fix: loading shared sessions (#3607)
  docs: use installer component for tutorial, add updating extensions section (#3608)
  fix: show token alert popover during agent responses and agent failure cases (#3536)
  reuse the cancellation token in the agent level (#3599)
  Docs: Move MongoDB tutorial to MCP section (#3602)
  docs: desktop recipe format (#3594)
  Fix model display name not being updated immediately after leaving settings (#3587)
  Added option to summarize the chat when an error is triggered (#3598)
  Remove mcp_macros and unused types (#3581)
  fix: add fallback id to messages if none provided (#3584)
  feat: migrate ErrorData from internal mcp crates to rmcp version (#3586)
  fix: adjust subrecipe description to allow running tests (#3585)
  Scenario tests (#3430)
  feat: migrate JsonRpcMessage/Request/Response/Error/Notification from internal mcp crates to rmcp versions (#3564)
  ...
michaelneale added a commit that referenced this pull request Jul 24, 2025
* main:
  Goose security updates (#3579)
  fix: multi-tool calls in streamed openai-compatible responses (#3609)
  feat: subagent turn count, simple agent loop (#3597)
  feat: subagent independent extension manager (#3596)
  Improve session history loading resiliency (#3588)
  Added logging and changed default route case to not redirect to home when there is an invalid route (#3610)
  fix: chat sidebar layout overlapping content occasionally (#3590)
  fix: loading shared sessions (#3607)
  docs: use installer component for tutorial, add updating extensions section (#3608)
  fix: show token alert popover during agent responses and agent failure cases (#3536)
  reuse the cancellation token in the agent level (#3599)
  Docs: Move MongoDB tutorial to MCP section (#3602)
katzdave added a commit that referenced this pull request Jul 24, 2025
* 'main' of github.com:block/goose:
  Adds the `WaitingForUserInput` state (#3620)
  docs: update extensions library (#3612)
  Fixing grants path (#3632)
  docs: June 2024 Community All-Stars Spotlight (#3631)
  grant program (#3630)
  Lifei/sub recipe desktop temp (#3576)
  docs: local LLMs context size tip (#3454)
  fix: Handle non-default base path for OpenAI compatible model fetching (#3566)
  Goose security updates (#3579)
  fix: multi-tool calls in streamed openai-compatible responses (#3609)
  feat: subagent turn count, simple agent loop (#3597)
  feat: subagent independent extension manager (#3596)
  Improve session history loading resiliency (#3588)
  Added logging and changed default route case to not redirect to home when there is an invalid route (#3610)
  fix: chat sidebar layout overlapping content occasionally (#3590)
  fix: loading shared sessions (#3607)
atarantino pushed a commit to atarantino/goose that referenced this pull request Aug 5, 2025
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