r/PiCodingAgent • u/behopkinsj • 1d ago
Plugin I Built an Orchestration Plugin That's Been Saving Me Costs
I built an orchestration plugin for Pi, with the goal of optimizing costs and making Pi more precise.
I've been wanting to build this for a while; it uses LangGraph to link agents together so that they focus on a single task, while Pi acts as the orchestrator. Once an orchestration flow is created, it can be reused later. So once you have an automation that works well, you can use it however many times you'd like.
So far, it's been saving me cost with long-running tasks. What do you all think?
Website: https://leafi.app/pi/
GitHub: https://github.com/Bruce-Hopkins/Leafi
1
u/patrick9331 20h ago
Why did you choose Langgraph?
1
u/behopkinsj 19h ago
I wanted to use something that could be used by whichever agents, if you choose to. But it's in it's earlier phases, so I might change the frameworks if that makes the plugin better
1
u/R3VO360 8h ago
Noob here, what's the difference between this and plain langgraph? Can you design a workflow where each node can decide whether it is needed to re-run the previous step of the pipeline with different parameters?
2
u/behopkinsj 8h ago
The main difference is that this gives you a lot of control. So you can set token budgets for each agent, Pi can link the agents by just tool calls instead of writing code, Pi can set the permissions of each node and let you know the final cost afterwards.
It basically gives Pi the freedom to make whatever graph it wants without having to write the code from scratch, so Pi can make quick design choices and iterate based on its learn feedback much quicker.
1
u/fingerthief 1d ago
Are there any numbers or measurements on cost?
All the studies and papers I’ve read on orchestration along with my own evals show it’s basically never actually cheaper. Certainly useful for other reason but not for cost.
0
u/behopkinsj 1d ago
I tried on Goose and it seemed to cut the cost in certain runs by 70%. I was mainly testing with web scapping. It mainly excels at multistep instructions, since they can be broken down with different agents and models. With DeepSeek, what one agent scrapped with 0.14$ to 0.50$, with the tool it ran at 0.04$ to 0.14$.
It also depends on the circumstances. Testing with LLMs are not deterministic. I'll have to find ways to do bigger and better tests.
0
u/fingerthief 1d ago
I could see potentially for scraping it could be cheaper. I think for real code implementation and research it likely would end up costing more.
I’d recommend running some available evals like SWE-bench or something similar and comparing the results.
I’d be super interested in seeing the result! There are many ways to do orchestration, always cool to see variations.
0
u/behopkinsj 1d ago
I'll have to do more testing on code. My thinking is that for research, or testing it might be more efficient. But we'll see.
Thanks! I'm glad you find it interesting
0
u/adamshand 1d ago
Yeah same. Everything I've read and tried seems better & cheaper to just use a single agent for most situations.
-2
u/No-Sandwich1809 1d ago
Low key would you built this, props. Saving real money is a flex too. Most devs just chase cool features, but cost-cutting? That’s the real upgrade. Gonna give it a spin soon!

8
u/invin10001 1d ago
Wait, how does putting multiple agents on the same task save costs? Shouldn't you break down the task so each is byte-sized for the right agent to pick up and implement? Maybe I'm missing the bigger picture, can you elaborate with an example?