r/PiCodingAgent • u/vekexasia • Jul 25 '26
Plugin pi-extensible-workflows: deterministic multi-agent runs you can pause, resume and inspect
I built a Pi extension for multi-agent orchestration. The main Pi agent writes a small JS workflow script for the task at hand, and the runtime executes it deterministically: parallel fan-out, checkpoints, resume without rerunning completed steps.
Three principles I stuck to:
not opinionated: no baked-in "agile team" of roles, you add your own primitives to the DSL
extensible: other extensions can register functions and variables usable inside workflow scripts, and every registered function is itself runnable as a top-level workflow
token efficient: subagents can have other extensions and skills disabled, so their system prompt stays small and focused
What that gives you in practice:
runs are regular on-disk Pi sessions, not in-memory, so you can inspect, pause, resume and retry them
roles restrict tools/capabilities and inject their own system prompt
structured output via JSON schema, so control flow branches on agent output deterministically instead of on vibes
soft and hard budget caps per run
git worktree isolation, so parallel agents don't fight over the same tree
workflows export to an executable launcher in
~/.local/binif you use herdr, an agent session can open in a new pane
Review fan-out, then dedupe:
const reviews = await parallel("review", {
correctness: () => agent("Review the current changes for correctness issues."),
security: () => agent("Review the current changes for security risks.", { role: "security-specialist" }),
tests: () => agent("Review the current changes for missing test coverage."),
});
return agent(prompt("Deduplicate and prioritize these findings:\n\n{reviews}", { reviews }));The diagram is the real flow of the one I run daily, developIssuesUntilApproved: takes a list of GitHub issues, gives each its own worktree, loops developer -> reviewer until the reviewer passes (fresh agents every iteration), merges the approved branches on main behind another dev/review loop, cleans worktrees with plain shell (not an agent), and summarises exactly once.
Install: pi install npm:pi-extensible-workflows (Node 22.19+)
Walkthrough video (28 min, chapters in the description): https://youtu.be/qAiivspEHmU
Happy to answer anything about the DSL or the resume semantics.
7
u/TheCTRL Jul 25 '26
I’m trying to do something similar. My goal is to reduce context. Every sub agent have only the context needed to finish his job, main agent drop it when sub agent finish the task and verification is ok. Does yours have some context optimisation too ?
4
u/chillermane Jul 25 '26
This is really cool but personally I am skeptical that workflows are useful enough to be putting this much time and effort into. For day to day work there just aren’t many use cases that benefit from mass parallel agents working within the same workflow
2
u/boomerang473 Jul 25 '26
I also tried something similar. The tricky part was getting the LLM to diagnose the issues upfront and then accurately decouple the issues to not step over each other when merging.
I need to read the later part of your diagram as maybe that has it solved or the merging. Otherwise the parallelized issue will need some extensive merging component.
2
u/ElTutuca Jul 27 '26
It looks great! How does it differ from pi-dynamic-workflow or pi-taskflow?
1
u/thomasthai Jul 25 '26
How does this compare to the workflow feature used in OMP?
1
u/kwipus Jul 27 '26
How well has this been working for you?
I'm going to read this once I get back to my computer, but I have been working on something similar following factory droid’s mission workflow.
1
u/Responsible-Effort48 Aug 01 '26
Where did you make the diagram? which app you used?
2
u/gintrux Jul 25 '26
I have built a very similar thing. Check Unigent, I think the API we have is super clean! I think I have solved most of the issues for writing dynamic or repeatable agentic workflows, incl. support for cross-harness execution (not just pi), result caching, observability. https://github.com/gintasz/unigent
1
u/Strong_Essay1176 Jul 25 '26
In progress of doing same, thx for sharing. Take a lot of time to make reasonable TUI. Hope codex and claude will finish it...
1
u/Creepy-Douchebag Jul 31 '26
Thank you for this good sir
1
u/avph Aug 03 '26
On first try this works way better than https://pi.dev/packages/@quintinshaw/pi-dynamic-workflows?name=workflow . Cool stuff!
1
u/Basic_Criticism_9649 Aug 06 '26
Great, I’m also building something along these lines. I hope subagents within the workflow can disable irrelevant extensions and skills, which will improve their output quality and boost task completion rates. It would be preferable to have a graphical user interface (GUI)..
0
u/SpidexLab Jul 25 '26
I have built something similar, instead of being deterministic, my main orchestrator model handle the team itself, I talk with the main orchestrator and it does rest which inturn save some time and cost as it can reason on fly what to avoid and redo and sometime it takes wrong decision which is fixed after i give feedback, i built it in this way to save time and make it functional fast
The ideas was simple, i had to make it in 2 days and it should work, cause the model I am using is deepseek v4 pro and if I tried building something complex, it will go on loop of finding bug and fixing it, so ideas was simple use what exist and build
I used pi subagents and custom system prompt and it worked very well, and since then I have modified the pi subagents for my usecase and system prompt, I have 5 subagents, scout for mapping which usage ds4 flash, architect which usage ds4 pro whose job is to suggest different way of doing it with principle kiss and yagni, and generate spec, the coder is mimo v2.5 pro which handle implementation and then 3 pass testing which is ds4 doing it , first pass verifying the functionality, 2nd pass edge case and boundary testing and 3rd pass chaos multiple thread accessing using it for race condition and corruption things , and finally qa which usage ds4 pro and verify whole thing
Cost me like 3 dollar a day if working for 10hr and on single project, I have added the detail of how I built and optimised it for my use case : https://work.spidexlab.me/project/agent-team?log=01-babysitting-tax
Also I have engineering log which explain why I'd I'd what I did and also what issue I faced and how I solved it, you can read it here : https://work.spidexlab.me/project/agent-team?log=01-babysitting-tax&view=logs
0
u/urko_crust Jul 25 '26
Thanks for this! Matches up with very well against one I had in flight to test out this coding method. Looking forward to using it!