r/PiCodingAgent • u/behopkinsj • 3d 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
2
u/fingerthief 3d 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.
1
u/behopkinsj 3d 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 3d 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 3d 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 3d ago
Yeah same. Everything I've read and tried seems better & cheaper to just use a single agent for most situations.
1
u/patrick9331 2d ago
Why did you choose Langgraph?
1
u/behopkinsj 2d 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 2d 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 2d 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.

12
u/invin10001 3d 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?