interactive conversation with an agent #2135

Closed
opened 2026-02-16 17:34:19 -05:00 by yindo · 18 comments
Owner

Originally created by @ferrao on GitHub (Oct 16, 2025).

Originally assigned to: @thdxr on GitHub.

I am trying to have an interactive conversation with an agent, which is triggered by a custom command, in a way that this agent's work is only done upon the user confirming so, something like:

[PLAN AGENT]
USER: /research "some topic"

[RESEARCHER AGENT]:

AGENT: Let me ask you some questions...
AGENT: Question 1
AGENT: Question 2
AGENT: Question 3
USER: Answer1
USER: Answer2
USER: Answer3
AGENT: Outputs result of research
AGENT: Are you satisfied with the results?
USER: Yes
AGENT: writes to file and terminates.

[PLAN AGENT]

But after issuing the first question, all remaining interactions fall back to the default PLAN agent.
Am I trying to do something that is not supported, or is there a way to make this flow work?

Originally created by @ferrao on GitHub (Oct 16, 2025). Originally assigned to: @thdxr on GitHub. I am trying to have an interactive conversation with an agent, which is triggered by a custom command, in a way that this agent's work is only done upon the user confirming so, something like: ``` [PLAN AGENT] USER: /research "some topic" [RESEARCHER AGENT]: AGENT: Let me ask you some questions... AGENT: Question 1 AGENT: Question 2 AGENT: Question 3 USER: Answer1 USER: Answer2 USER: Answer3 AGENT: Outputs result of research AGENT: Are you satisfied with the results? USER: Yes AGENT: writes to file and terminates. [PLAN AGENT] ``` But after issuing the first question, all remaining interactions fall back to the default PLAN agent. Am I trying to do something that is not supported, or is there a way to make this flow work?
yindo closed this issue 2026-02-16 17:34:19 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Oct 16, 2025):

This issue might be a duplicate of existing issues. Please check:

  • #2315: Custom commands with agents should(?) run in isolated sessions - discusses how custom commands with agents don't run in isolated sessions like @agent syntax
  • #3161: Custom commands don't appear in message history - related to custom command session behavior and context management
  • #2352: Subagents cannot interact normally - describes issues with subagent session management and unpredictable behavior

Feel free to ignore if none of these address your specific case.

@github-actions[bot] commented on GitHub (Oct 16, 2025): This issue might be a duplicate of existing issues. Please check: - #2315: Custom commands with agents should(?) run in isolated sessions - discusses how custom commands with agents don't run in isolated sessions like @agent syntax - #3161: Custom commands don't appear in message history - related to custom command session behavior and context management - #2352: Subagents cannot interact normally - describes issues with subagent session management and unpredictable behavior Feel free to ignore if none of these address your specific case.
Author
Owner

@rekram1-node commented on GitHub (Oct 16, 2025):

@ferrao is this specifically with a subagent? Currently you can't talk to subagents which imo is a poor ux and we should fix

is this specifically with a subagent

If so I will close and link the other issue that tracks talking to subagents

@rekram1-node commented on GitHub (Oct 16, 2025): @ferrao is this specifically with a subagent? Currently you can't talk to subagents which imo is a poor ux and we should fix >is this specifically with a subagent If so I will close and link the other issue that tracks talking to subagents
Author
Owner

@ferrao commented on GitHub (Oct 16, 2025):

@ferrao is this specifically with a subagent? Currently you can't talk to subagents which imo is a poor ux and we should fix

is this specifically with a subagent

If so I will close and link the other issue that tracks talking to subagents

No, this is with a regular agent, I have tried it with a subagent first, but you told me I could not do it in another issue, so I tried it with an agent.

@ferrao commented on GitHub (Oct 16, 2025): > [@ferrao](https://github.com/ferrao) is this specifically with a subagent? Currently you can't talk to subagents which imo is a poor ux and we should fix > > > is this specifically with a subagent > > If so I will close and link the other issue that tracks talking to subagents No, this is with a regular agent, I have tried it with a subagent first, but you told me I could not do it in another issue, so I tried it with an agent.
Author
Owner

@rekram1-node commented on GitHub (Oct 16, 2025):

Ahh I think I follow then, when you trigger the command it sends it to a certain agent, but then it doesnt actually change your selected agent...

I see

@rekram1-node commented on GitHub (Oct 16, 2025): Ahh I think I follow then, when you trigger the command it sends it to a certain agent, but then it doesnt actually change your selected agent... I see
Author
Owner

@ferrao commented on GitHub (Oct 19, 2025):

Ahh I think I follow then, when you trigger the command it sends it to a certain agent, but then it doesn't actually change your selected agent...

I see

Indeed... But it's even worse... Because If I change it manually, I can start to interact with the agent that work has been delegated to (RESEARCH), but each input that I provide, is also somehow fed back to the main agent (PLAN) and I end up with two sessions, one for each agent, with similar, but different state. A whole mess, that I can not get out of.

@ferrao commented on GitHub (Oct 19, 2025): > Ahh I think I follow then, when you trigger the command it sends it to a certain agent, but then it doesn't actually change your selected agent... > > I see Indeed... But it's even worse... Because If I change it manually, I can start to interact with the agent that work has been delegated to (RESEARCH), but each input that I provide, is also somehow fed back to the main agent (PLAN) and I end up with two sessions, one for each agent, with similar, but different state. A whole mess, that I can not get out of.
Author
Owner

@ferrao commented on GitHub (Oct 19, 2025):

So, what I am saying is that I identify 2 problems:

  1. When a command triggers an agent subtask, opencode does not change to that agent automatically
  2. If we change to that agent manually, interaction between user/agent somehow leaks to the main context
@ferrao commented on GitHub (Oct 19, 2025): So, what I am saying is that I identify 2 problems: 1) When a command triggers an agent subtask, opencode does not change to that agent automatically 2) If we change to that agent manually, interaction between user/agent somehow leaks to the main context
Author
Owner

@rekram1-node commented on GitHub (Oct 19, 2025):

@ferrao in regards to point 2 thats because you cant talk to a subagent, and I dont like that either I think we need to allow

@rekram1-node commented on GitHub (Oct 19, 2025): @ferrao in regards to point 2 thats because you cant talk to a subagent, and I dont like that either I think we need to allow
Author
Owner

@ferrao commented on GitHub (Oct 19, 2025):

@ferrao in regards to point 2 thats because you cant talk to a subagent, and I dont like that either I think we need to allow

Not sure what you mean, I am getting very confused with how I am supposed to use the agents functionallity.
My workflow is never about giving AI a task and waiting for it's conclusion on it's own.

I always like to interact with AI to get to my end result. But still, I want to take advantage of having dedicated agents with different skills and commands that load appropriate context and trigger those conversations, but I am not able to do any of it.

Am I trying to do something that is just completely off how this is supposed to work?

@ferrao commented on GitHub (Oct 19, 2025): > [@ferrao](https://github.com/ferrao) in regards to point 2 thats because you cant talk to a subagent, and I dont like that either I think we need to allow Not sure what you mean, I am getting very confused with how I am supposed to use the agents functionallity. My workflow is never about giving AI a task and waiting for it's conclusion on it's own. I always like to interact with AI to get to my end result. But still, I want to take advantage of having dedicated agents with different skills and commands that load appropriate context and trigger those conversations, but I am not able to do any of it. Am I trying to do something that is just completely off how this is supposed to work?
Author
Owner

@rekram1-node commented on GitHub (Oct 19, 2025):

@ferrao You said:

If we change to that agent manually, interaction between user/agent somehow leaks to the main context

What I interpreted this as:

"When I try to talk to a subagent the conversation leaks to main context"

What I was saying:

Currently the primary agent or a command invokes a subagent, and you navigate to the child session, subsequent messages are sent to primary agent instead of the subagent. This is intentional, but i think it is confusing so it will likely be changed

@rekram1-node commented on GitHub (Oct 19, 2025): @ferrao You said: > If we change to that agent manually, interaction between user/agent somehow leaks to the main context What I interpreted this as: "When I try to talk to a subagent the conversation leaks to main context" What I was saying: Currently the primary agent or a command invokes a subagent, and you navigate to the child session, subsequent messages are sent to primary agent instead of the subagent. This is intentional, but i think it is confusing so it will likely be changed
Author
Owner

@ferrao commented on GitHub (Oct 19, 2025):

@ferrao You said:

If we change to that agent manually, interaction between user/agent somehow leaks to the main context

What I interpreted this as:

"When I try to talk to a subagent the conversation leaks to main context"

What I was saying:

Currently the primary agent or a command invokes a subagent, and you navigate to the child session, subsequent messages are sent to primary agent instead of the subagent. This is intentional, but i think it is confusing so it will likely be changed

You keep saying subagent. I am not using those anymore, as you stated that interactive conversations with subagents are not possible in #2352 . Everything that I am saying in this issue, is regarding agents, not subagents.

@ferrao commented on GitHub (Oct 19, 2025): > [@ferrao](https://github.com/ferrao) You said: > > > If we change to that agent manually, interaction between user/agent somehow leaks to the main context > > What I interpreted this as: > > "When I try to talk to a subagent the conversation leaks to main context" > > What I was saying: > > Currently the primary agent or a command invokes a subagent, and you navigate to the child session, subsequent messages are sent to primary agent instead of the subagent. This is intentional, but i think it is confusing so it will likely be changed You keep saying subagent. I am not using those anymore, as you stated that interactive conversations with subagents are not possible in #2352 . Everything that I am saying in this issue, is regarding agents, not subagents.
Author
Owner

@rekram1-node commented on GitHub (Oct 19, 2025):

@ferrao but are you using subtask: true because that is a subagent, it was created so you could run things outside of primary context (ie: as a subagent)

Sorry for any confusion

@rekram1-node commented on GitHub (Oct 19, 2025): @ferrao but are you using `subtask: true` because that is a subagent, it was created so you could run things outside of primary context (ie: as a subagent) Sorry for any confusion
Author
Owner

@ferrao commented on GitHub (Oct 19, 2025):

@ferrao but are you using subtask: true because that is a subagent, it was created so you could run things outside of primary context (ie: as a subagent)

Sorry for any confusion

I am using:

"mode": "primary",

I would have to set mode to subagent for it to be a subagent, no?

@ferrao commented on GitHub (Oct 19, 2025): > [@ferrao](https://github.com/ferrao) but are you using `subtask: true` because that is a subagent, it was created so you could run things outside of primary context (ie: as a subagent) > > Sorry for any confusion I am using: ``` "mode": "primary", ``` I would have to set `mode` to `subagent` for it to be a subagent, no?
Author
Owner

@rekram1-node commented on GitHub (Oct 19, 2025):

Does your custom command have subtask in it?

@rekram1-node commented on GitHub (Oct 19, 2025): Does your custom command have subtask in it?
Author
Owner

@ferrao commented on GitHub (Oct 19, 2025):

Does your custom command have subtask in it?

I have tried both options and I hit different problems.

  1. subtask=true, that session leaking thing happens. From your answers and latest comment, can I assume that this subtask option will override the agent configuration and make it work as a subagent, even if it is configured as a primary? If that is the case, can we update the docs, so that it becomes clear?

  2. subtask=false, The researcher agent is triggered initially, but no separate session is created, so I can not interact with it. Somehow, then main agent know about the agent's response and picks up from there, and everything continues/happens on the main session, so I loose the agent specific capabilities.

@ferrao commented on GitHub (Oct 19, 2025): > Does your custom command have subtask in it? I have tried both options and I hit different problems. 1) `subtask=true`, that session leaking thing happens. From your answers and latest comment, can I assume that this `subtask` option will override the agent configuration and make it work as a subagent, even if it is configured as a primary? If that is the case, can we update the docs, so that it becomes clear? 2) `subtask=false`, The `researcher` agent is triggered initially, but no separate session is created, so I can not interact with it. Somehow, then main agent know about the agent's response and picks up from there, and everything continues/happens on the main session, so I loose the agent specific capabilities.
Author
Owner

@rekram1-node commented on GitHub (Oct 19, 2025):

For subtask we do document this: https://opencode.ai/docs/commands/#subtask

But I suppose it needs to be more clear

@rekram1-node commented on GitHub (Oct 19, 2025): For subtask we do document this: https://opencode.ai/docs/commands/#subtask But I suppose it needs to be more clear
Author
Owner

@ferrao commented on GitHub (Oct 20, 2025):

For subtask we do document this: https://opencode.ai/docs/commands/#subtask

But I suppose it needs to be more clear

If you can confirm that this command config option will make the agent run as subagent, no matter how it is configured, I'll be happy to submit a doc PR with this change.

@ferrao commented on GitHub (Oct 20, 2025): > For subtask we do document this: https://opencode.ai/docs/commands/#subtask > > But I suppose it needs to be more clear If you can confirm that this command config option will make the agent run as subagent, no matter how it is configured, I'll be happy to submit a doc PR with this change.
Author
Owner

@rekram1-node commented on GitHub (Oct 20, 2025):

@ferrao that is correct, sorry for the confusion

@rekram1-node commented on GitHub (Oct 20, 2025): @ferrao that is correct, sorry for the confusion
Author
Owner

@rekram1-node commented on GitHub (Oct 20, 2025):

closing since this is now documented to remove confusion, I will publish updated docs soon

@rekram1-node commented on GitHub (Oct 20, 2025): closing since this is now documented to remove confusion, I will publish updated docs soon
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#2135