r/opencodeCLI • u/miangelo • 2d ago
Is the change "Background Subagents by Default" since v2.3.0 good?
Since version 2.3.0, OpenCode now runs background agents by default. As far as I know, there is no option to disable this, so this seems to be enforced.
I tried this new setup but it seems to me that it is just adding extra turns with no real value. For example, say you have an orchestrator and that orchestrator calls four different Explorer agents.
With the old way of having those sub-agents working on the foreground, the orchestrator would wait for the four different explore agents to return, it would check their outputs and then it would produce its own output having taken into account all of them.
Now what happens is that it dispatches the four sub-agents and then returns.
When the first sub-agents comes back, it checks its output and says ok, let's wait for the other three to come back.
Then the second one comes back, checks its output and says, ok, let's wait for the other two to come back.
Then the 3rd one comes, checks its output and says, let's wait for the last one to come back.
And when the 4th one comes back, it then outputs a final.
From what I understand, each time that a subagent comes back and our orchestrator checks its output, that is a request that sends the entire context to the API servers. Sure it is most probably cached, but it is still billed. Isn't that way of working very inefficient? Am I missing something?
EDIT: It looks like there is an active issue about this on GH
https://github.com/anomalyco/opencode/issues/64073
EDIT2: Apparently they closed the issue saying "We aren't bringing back blocking subagent calls, so closing as not planned."… 🤬
6
u/look 2d ago
Add an instruction to your AGENTS.md to use foreground subagents by default. The model can still do that; it just prefers the background by default now.
3
u/SirRobinBlibs 2d ago
Since 2.3.0 the background option is gone: every subagent returns a session id immediately, and the parent gets a report each time the child goes idle, then again after later rounds of work. So yes, those intermediate "still running" or idle reports can start an extra parent turn, not only the final result.
I wouldn't treat every wake as a guaranteed full-price replay of the whole parent context — that depends on whether the provider cache is still warm — but it is still a model call, and the docs don't currently offer a "final report only" switch. If the orchestrator is chatting after every idle, I'd batch the child work so it reports once when it's actually done, rather than asking the parent to reconcile after each explorer.
3
u/JSA343 2d ago
No, the way it was implemented was not a good change. Background by default is fine, but completely removing real blocking/foreground behavior was a really bad move. Removing foreground execution entirely just wasn't even necessary, why take out options? I find it hard to believe no one saw any problems with removing the way it's been working all along, that no one would have any workflows and expectations based on or any uses for deterministic subagent returns?
Need to wait for all implementing subagents to return before running build checks, otherwise builds may happen while code is still being actively modified. A planner or investigator that needs all parallel recon tracks to return before making decisions or really analyzing results in the full context.
Sure, you can start adding a bunch of system prompt instructions to try to tell your agents to wait for parallel dispatch to return before acting, but the way it's currently implemented this is still an inference turn and the agent can hallucinate responses or ignore that instruction. It's not hard determinism.
Not to mention the wasted full inference turns just for the primary agent to say "still waiting on subagent X". Hopefully the cache is warm, but it's still a cost. If you have subagent depth, where subagents spawn their own subagents (think an orchestrator spawns a planner to rethink a task plan, and that planner dispatches a wave of parallel recon subagents), then every lower subagent report wakes up every parent up the chain just to say "still waiting"! In an orchestration session that can mean cascading wakes and full turns up to the higher tier/more expensive models.
This change was just really rushed and not well thought out. Even besides the foreground removal issue, there just needs to be more controls for agents to handle background status updates without wasting turns. And radio silence for almost two weeks on addressing anything isn't a good look.
1
u/rubadub69 2d ago
You are missing a lot, you are actually saving context by using subagents as you allow orchestrator to preserve most context, make less mistakes and use less tokens on debugging and figuring out what was missed.
2
u/bokerkebo 2d ago
i agree with you, i am also wondering if this change is good, and i am actually thinking about moving back to opencode v1. sure we can solve things faster here, but i wonder if the cost is worth it
1
u/bitzap_sr 2d ago edited 2d ago
Spawning in the background lets you continue to talk with the orchestrator.
But then I use Pi and not opencode and this just appeared in my feed. :)
1
u/Sontemo 2d ago
I think in general the change is good. It saves you money in two ways:
Running into cold caches cause your 4 agents took a long time to run and finish. Some providers have only a 5 minute cache, so 4 small status updates against a warm cache are much much cheaper than just one request against a cold cache.
Spreading out subagent results can help with not busting the KV cache due to too big individual requests on the next turn.
What I personally like to do is not to wait, but essentially instruct my agent to review the individual slices as they come in (if applicable).
1
u/Kitchen_Fix1464 2d ago edited 2d ago
*edit - misread a comment on the issue.
1
u/riktech_76 1d ago
did you notice a difference in total run time too, or mostly extra turns? curious if the parent calls make the whole thing slower when all four explorers finish close together
1
u/Future_AGI 1d ago
one traced run would settle the cost question: take a single four-explorer task on 2.3.0, count the parent LLM calls each subagent report triggers, and check how many of their input tokens came back as cache reads. The opencode plugin in traceAI (npx u/traceai/agents setup opencode, 2.x from 2.2.5) keeps background children and the continuations their completions trigger inside the original prompt's trace, with input, output, cache-read and cache-write tokens on the model calls in that trace. traceAI is linked from https://github.com/future-agi/future-agi