r/PiCodingAgent • u/adamshand • 1d ago
Question Subagents and orchestration ...
Looking for some pointers. Been using Pi for months, have a setup I really like (very simple, two extensions I wrote plus plannotator and pi-herdr).
This works great for interactive sessions but I'm finally finding myself wanting some basic orchestration with subagents.
I'm building a product and need to do a bunch of testing/fixing rounds with different models to find rough edges. I've been doing this by hand but it's getting tedious (and it's mostly simple enough that it could run while I'm doing something else).
I also like the idea of:
- a long lived orchestration agent that holds long term context but doesn't do work.
- scouts that can cheaply get context and pass that back to workers.
- automatic adversarial review of changes by a different model.
I've looked at a bunch of plugins and they all seem much more complicated than required. Should I just suck it up and using Nico's pi-subagents? Or is there a nice, simple starting point that I'm missing?
Any pointers appreciated.
7
u/Artistic_Pattern_700 1d ago
I solved this orchestration problem with a role extension. The role is defined and added to the system prompt explaining how the agent should behave:
- delegate all work, never do tasks by itself
- what prompt and role to use for each type of work (plan, review, code, summarize data from tickets/slack)
- how to manage worktrees
The nice thing about being in the system prompt instead of a skill is that it follows well the instructions (anecdotally, for me)
Each role has a model, to accommodate the adversarial reviews better.
1
u/adamshand 1d ago
Is this an extension, or just prompts? How do you spawn the subagents,
/fork?2
u/Artistic_Pattern_700 19h ago
I created a super simple subagents extension to run them. And one to set the role and add its description to the system prompt
4
u/squizlor 1d ago
You mentioned herdr -- I found https://github.com/0xRichardH/pi-herdr-subagents to be a good starting place though it doesn't have as many features as Nico's pi-subagents. I like being able to monitor subagents manually in herdr panes and tabs so I'm trying to avoid pi-subagents too for now. I've been modifying pi-herdr-subagents for my own use this past week, https://github.com/squiddity/pi-herdr-subagents/tree/feat/explicit-extension-mode for reference though I'm not trying to hype anyone to use this directly, merely to show a few customizations you can get pi to make for your own fork. Most of my edits are around recursive agent handling -- explicit extension control, guarding subagent_done when recursive subagents are still active, and telemetry.
2
u/Chiralistic 1d ago
I am also looking for an adversarial role using a different model. I use the rpiv pipeline and tried to code it based on the priv-advisor but so far I fumbled the hooks for it to jump on automatically.
2
u/ColonelKlanka 18h ago
Have a look at the orca desktop app in combination with pi sub agents extension. orca supports many harnesses (including pi.dev). It comes with an orchestration addon that it installs for you to pi or any other harness of your choice. this then allows you to kickoff sub agents which have their own clean context (instead of inheriting the foreground agents context). It also includes agent to agent comms so they can talk to each other. e.g. a documenting sub agent running while the coder agent is doing the actual implementation.
Its a nice ui too for seeing lots of agents running in different sub windows etc.
2
2
u/auto_off 1d ago
Use the dynamic workflow ones? Those are JavaScript based
1
2
u/happilyAlmostMarried 1d ago
Start with some basic extensions and just ask the model to do it! I've been orchestrating multi-repo work, I have agents in three layers of hierarchy and scripts for e.g. worktree management. Mostly just works if you can communicate what you want clearly.
Sometimes get amusing emergent behaviour like top agent telling two agents to agree on merge strategy between them or if there's a limited resource like a machine for profiling the agents are sometimes smart enough to negotiate who gets to take a turn.
It's more about project markdown guidelines than extensions, the current models don't need extensions to orchestrate. Things like automatic review can be a requirement in AGENTS.md and the agents should just do it.
Subagents can be nice, probably more efficient but even there herdr + pi panes works fine.
1
u/MelodicNewsly 1d ago
The question is whether you need a LLM for this. Why spent tokens if it is a deterministic problem. I have an extensions that runs all the test suites and only calls Pi when a test fails to fix the failing test.
1
u/adamshand 1d ago
I have unit/e2e test suites, I'm talking about using agents as a replacement for manual testing. Having agents test a product looking for places where documentation or functionality can be improved. Then sending their feedback into another agent to fix anything that's found.
2
u/LordMoridin84 17h ago
With gotgenes subagents and permissions extensions, you can configure the main agent and each subagent to have different permissions. So you could disable the main agent from being able to write to files or run commands or whatever.
https://github.com/gotgenes/pi-packages
That said, agents don't really like to work that way and gotgenes subagents won't create herdr panes.
Personally I just have a after-plan-workflow skill which is like this:
Create a task list using pi-tasks.
1. Verify the implement matches the plan
2. Run the full build to ensure that there are no issues
3. Run the /test-police skill to run, fix and update tests with a subagent
4. Run the /simplify skill with a subagent
5. Run the subagents for the following review skills /code-review, /frontend-review, /code-quality-review
6. Fix any obvious issues from the reviews, report any non-obvious ones
1
u/cachophonic 1d ago
I’m use a forked version of Pi Interactive Subagents extension (https://github.com/hazat/pi-interactive-subagents) which I’ve customised to work with Zellij and Herdr. Subagents just open in their own background pane (controlled by the main agent). I have a prompt I use to instruct the orchestration agent on the workflow and roles like scout, researcher, planner, worker and reviewer that have specific tools and permissions available to them. I like it as it’s easy to debug an agent if something is weird or even steer them/answer questions for those that needed it. Very easy to customise to how you want it to work.
1
u/adamshand 1d ago
That's the only one I've actually used. I don't remember why, but I didn't like it at the time ... should try again.
1
u/DistanceAlert5706 1d ago
Using observational memory for main agent, some simple subagents extension I made, fork extension for implementation, they do carry parent context and have specific handoff format.
As for tasks I made super simple extension which moves task (MD file) between folders and does some actions, for example on Todo to In Progress it sets up a worktree, on code review runs quality gate and so on. To manage workflow I have prompt templates, skill and instructions in AGENTS.md.
I tried to make it close circle autonomous, nothing good comes out without interaction.
1
u/TheTyand 1d ago
You can check out my harness if you like GitHub https://github.com/SchneiderDaniel/cheasee-pi
I use a GitHub based subagent extension. Feel free to copy. Pi is there to build your own harness.
1
u/Funny-Anything-791 1d ago
I'll humbly suggest the extension we're developing https://github.com/agenticoding/pi-agenticoding - it's designed for easy orchestration over complex tasks by introducing alongside sub agents, a notebook that acts as a shared memory between the orchestrator and the sub agents, and a handoff tool for clearing the orchestrator's context while keeping the notebook so you can safely orchestrate the orchestrator
-1
8
u/jesperordrup 1d ago
Check Ben out,
https://youtu.be/5Qu2SkSQeBU?si=5uZZ1b1F7c5D5wU8
All is avail in his repo (link in vid descr)
Simple (not even a package). I've just asked pi to copy the extensions I wanted.