Skip to content

Control flow from main agent to subagent and back to main agent #2686

Closed as duplicate

Description

@venkatr21

Hey,
I have a main agent

Image

and a bunch of sub agents (one in the example)

Image

I use the main agent as an orchestrator, and the subagent as a specialized agent which does the atomic task. The prompts define control flow from main agent to sub agent and again back to main agent (as handover).
We see that when the main agent hands over to subagent, which might ask a user input, to accomplish its task, somehow the main agent starts over all again, this this goes into an endless loop.

Pretty confused why this is happening and how to fix this. Any help here please?

Activity

  1. venkatr21 commented on Sep 19, 2025

    @venkatr21
    Author

    @thdxr any inputs on this?

  2. rekram1-node commented on Sep 19, 2025

    @rekram1-node
    Collaborator

    can you share a session of this? I havent seen it before

    edit: nvm I misunderstood post originally

  3. anuramat commented on Sep 19, 2025

    @anuramat

    shouldn't the description of the main agent be a prompt instead?

  4. rekram1-node commented on Sep 19, 2025

    @rekram1-node
    Collaborator

    just to note:

    description: used so a primary agent can designate tasks to the given agent (this is basically a prompt for the main agent to know if it should call this agent or not)

    prompt: this is the prompt the agent is being given

  5. NaikSoftware commented on Sep 21, 2025

    @NaikSoftware

    can you share a session of this? I havent seen it before

    its the same #2378

    Now work with subagents almost impossible because thea are implemented just as prototype: some part of work can be delegated and that's all. You can't control anything:

    • decline some edit and guide in right path
    • queue some message to subagent to refine task details
    • ask user via subagent for some decision

    Spoiler: all these points are not fantastic, already implemented in ClaudeCode and it's the reason why I switched to it.

    Now Opencode subagents can just receive prompt for the subtask and return some result.

  6. rekram1-node commented on Sep 22, 2025

    @rekram1-node
    Collaborator

    You can navigate to the child session and communicate with the subagent directly actually but we definitely need to make that permissions feedback better

    edit: my bad mistake

  7. NaikSoftware commented on Sep 22, 2025

    @NaikSoftware

    You can navigate to the child session and communicate with the subagent directly actually but we definitely need to make that permissions feedback better

    All messages sent to subagents are actually sent to main agent

  8. rekram1-node commented on Sep 22, 2025

    @rekram1-node
    Collaborator

    @NaikSoftware you're right! I missed that thanks for calling out.

    I raised with the team that some of the UX for subagents isn't quite as good as CC as you have called out. Thanks for the continuous feedback here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions