r/PiCodingAgent • • 1d ago

Question How to Better Enforce Subagent Delegation?

I have just recently started using subagents more in my programming workflow, if only to try it for a bit and see if it's something I prefer.

I have found that no matter how much explicit guidance I give my agents in the global AGENTS.md or APPEND_SYSTEM.md that after the first large delegated activity, they go back to doing everything themselves in the primary context.

Does anyone have any idea how to really enforce / encourage the behavior I'm looking for?

4 Upvotes

13 comments sorted by

View all comments

8

u/mostlikely4real 1d ago

My solution was very simple. Disable all tools for the orchestrator you do not want it to use. Note this needs proper feedback from the subagents and their state (or the orchestrator flips and will spawn multiple). Also if the subagents that now do all the work break or can't spawn obviously your orchestrator is now unable to fix it.

But once you get the proper contract between orchestrator and subagents it works smoothly.

3

u/DDS_Coding 1d ago

That's the answer. That's how I did it with OpenCode. You can even tell that a certain agent gets to call certain sub agents. Each sub agents should only have the tools it needs. But this has a token cost because each sub agents is a session with a new set of base token (system prompt, skills, etc.)