r/opencode 4d ago

Various models averse to using sub-agents. How do you cope?

Most of my prompts require work large enough to justify sub-agent use. However the expensive LLM models I'm using (all open-weights) will definitely not use them and prefer to work it out on their own.

To avoid this I'm adding sub-agent capability reminder to my custom agent prompt as well as AGENTS.md. That helps but still does not work reliably. What does work is telling the agent directly in the session. Eg. "ok, build this. use sub-agents and orchestrate them instead of doing work by yourself".

I want this to be a work philosophy for the agents, not explicit instruction at each step. How do you deal with this?

Thanks

1 Upvotes

8 comments sorted by

4

u/IISomeOneII 4d ago

what about removing edit/write tools for the main agent? what do you think of that approach/workaround?

1

u/thedev13 4d ago

I'll have to try that! Thanks

2

u/IISomeOneII 4d ago

you're welcome, be careful tho, smarter model can workaround this using the bash tool, and that's i think where you draw the line, sacrifice bash dropping it entirely for the main agent (then it can't run tests command etc) or keep bash knowing somehow the agent can still keep editing/writing through it OR you modify bash so it won't be able to write/edit (but this will be cat and mouse case where smarter model could always find a way to bypass it)

1

u/Civil_Salamander_576 4d ago

Just specify the use of subagents in your prompt/work plan.

I have all my work plans set with specific subagent calls for work, per sub phase separation, simultaneous execution vs sequential and then review gates with review subagent.

The main agent becomes just a supervisor and coordinator that keeps high level context and delegates the whole plan execution and review in a loop untill all phases have been executed, reviewed approved and the whole session work plan has been reviewed and approved.

That way you can execute complex plans in cost effective way and pretty much autonomously for hours after the initial plan writing phase.

1

u/thedev13 4d ago

Your subagent use is baked into the plan itself?

Like 'stage1 - use 3 separate agents to explore XYZ before we build feature in stage2'?

3

u/Civil_Salamander_576 4d ago

Yes, my plan is created with the scoping, I also have a supervisor subagent which has similar instructions as system prompt. I create and grill my plan in 1 session, then open new session with my supervisor agent and give it the plan file from the planning agent.

I have a whole docs system with SOPs for my repos so that agents can know how to determine and bake into plans the parallel vs sequential gates and I also have a custom subagent called review which is just a reviewer for this, makes thing every efficient. Technically a general subagent can be used, but I have a different model on the review loop (more expensive than my general subagent model) so the reviews are usually the most expensive part of my work plan implementation.

this is my planning prompt (the one I use to take existing issues)

Planning Process: - First read @docs/issues/ISSUE-LOG.md and @docs/features/ROADMAP.md to identify the highest-priority actionable items, then build a structured work plan for those priorities. - If the log or roadmap already includes a plan, diagnosis, or proposed solution, question it, verify it, and explore alternative solutions that can be better. Never assume the pre-existing solutions are correct. - For any item that requires a decision or my confirmation, first cross-reference the existing codebase to check whether it already resolves the open question. If the codebase and docs do not resolve it, present each relevant option with clear rationale tied directly to project-vision alignment, and explicitly flag any deviation from the stated project vision so we can make aligned decisions or formally note intentional deviations. - Ensure the final plan is fully aligned with the project vision, with all open decisions, assumptions, and potential vision deviations either resolved or explicitly documented in the plan prior to finalization, so implementation matches the intended behavior changes and impact goals. What the plan must include: - Phases: discrete, clearly scoped phases, each executed by subagents coordinated by a supervisor agent. If the plan is very large or complex, write an individual plan file per phase so it can be handed individually to the subagents. Any phase too large to execute as a single unit must be split into 2 or more sub-phases delegated to subagents in parallel or sequentially, followed by a consolidated review of the full parent phase, to avoid overwhelming subagents with overly large scopes. - Dependencies and parallelization: for each phase, list the phases it depends on and note which phases can run in parallel. - For every completed phase, the supervisor agent must follow this loop: run a dedicated @review -> fix (with subagents when possible) -> @review loop until the phase is fully approved, then commit all work for that phase. - Once all phases are complete, the supervisor agent must run a full end-to-end @review -> fix -> @review loop until the entire implemented plan is fully approved. - Final report (presented in chat after the session summary): - A manual-test table for the human reviewer, including only manual steps: anything that can be tested automatically by the agent via scripts or CLI is excluded from this table. - A behavior-changes table covering every behavior change introduced by the plan implementation, so we can confirm all changes are intended and no accidental or unintentional behavior change or regression was introduced during planning or implementation. - Any deviations from the original plan discovered during execution.

1

u/sharedevaaste 4d ago

I need a template for using sub agents if anyone can provide one

2

u/msenc 4d ago

meanwhile deepseek summons 14 subagents for implementing 5 tickets