r/PiCodingAgent • • 18h ago

Plugin I Built an Orchestration Plugin That's Been Saving Me Costs

Post image

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

44 Upvotes

12 comments sorted by

5

u/invin10001 14h 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?

4

u/behopkinsj 13h ago

Yeah! So the agents pass context to each other. One works, and only sends the information to the next agent. So each agent isn't receiving the full conversation, just the work it needs.It ends up saving on cost.

Since a single LLM isn't reading the entire history, the agents tend to be more accurate too.

2

u/ThankYouOle 2h ago edited 53m ago

i am working on my own solution with this similar approach, but my log said it didn't work like that.

imagine like this:

- agent 1 read the file for mapping and planning

- it create good list file and plan, and then return it to the 'manager',

- then manager bring that output as context for 2nd agent,

- in my expectation the 2nd agent already have knowledge and context, but turn the 2nd agent kind of didn't trust it,or ignore it, and keep re-reading all the files and history.

but i notice this kind of behavior only on Deepseek model, i tried with Terra it goes straight away even without mapping.

0

u/invin10001 13h ago

I see it now. Neat. I'll try it out.

1

u/Tafes-Haiba13 9h ago

suspect they just worded that part weirdly and meant each agent gets its own narrow sub-task, so youre not stuffing the entire repo into one giant context window on every turn

1

u/fingerthief 13h 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 13h 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 13h 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 12h 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 3h ago

Yeah same. Everything I've read and tried seems better & cheaper to just use a single agent for most situations.

2

u/swagonflyyyy 11h ago

I was using a different one and noticed my orchestrator agent ranting:

Guess it worked lmao.

-1

u/No-Sandwich1809 4h 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!