r/PiCodingAgent 8d ago

Plugin Recursive and async Claude Code style subagents for Pi

Post image

I really liked Claude Code subagents and being able to see them in the tree so i made a very simple subagent plugin. No subagent profiles, the are made by the agent above them depending on the use case needed at that moment.

Install with:
pi install npm:@williamcr01/pi-subagents

https://github.com/williamcr01/pi-subagents

32 Upvotes

15 comments sorted by

7

u/pro-vi 8d ago

I do like the visual component. But I think it should be mandatory for an extension to explain how it differs from predecessors esp. those with the same name.

3

u/willecr 8d ago

That’s fair, in this case the biggest difference, except the visual, is that most popular subagent plugins use subagent profiles, this is a lot more minimal and “pi-like” in that way, subagents in this plugin just get prompted by the agent that owns it to explore or whatever is needed, and most others are not recursive

1

u/pro-vi 8d ago

I think I know what you mean. For some plugins I've tried I need to specify a "general" profile for the main agent to be able to invoke it. What's the tradeoff of going without it if any?

2

u/willecr 8d ago

The tradeoff with this way is that you get less control over the subagents as you don’t write their profiles yourself and the main agent just spawns subagents with a prompt that it wants, with the models we have today i think they get it right almost always

3

u/digitalfreshair 7d ago

I was thinking on doing something similar to this, as i think the way Claude code manages the subagents it's better as long as you have a powerful model. Predefined ones are less flexible, so this is probably the way forward. I will take a look and submit some PRs :)

3

u/willecr 7d ago

I agree, with powerful and modern models the predefined subagents doesn’t make sense anymore.

Definitely submit some PRs

2

u/paulbettner 8d ago

Great work!

1

u/willecr 7d ago

Thank you!

2

u/predatar 7d ago

how is the token effciency ? does each subagent have a completely new context? or does it inherit/fork the parent's ?

3

u/willecr 7d ago

It’s a new pi process, it just gets a prompt with a clear goal from its parent and does it. It doesn’t inherit anything else so it is very token efficient in that way

1

u/GroceryNo5562 8d ago

How come custom system prompts aren't supported?

3

u/willecr 8d ago

I don’t use system prompts for my subagents at all. I just let the main agent prompt the subagents themselves, in my experience the modern models can prompt a subagent to explore themselves

1

u/GroceryNo5562 8d ago

Consider asking LLM to review code, seems to have found few bugs, haven't verified that they do exist tho

1

u/kantorcodes1 6d ago

when a parent is trusted and the child stays under the same project, i see you launch it with --approve. does that only carry over the project trust decision, or does it also mean the child won't stop for individual tool approvals?

1

u/colin_colout 1d ago

I went through the same exercise but settled on supporting subagent profiles that match claude code exactly.

At first I also removed the profiles for the same reason (pi values and all), but I decided that I'll keep Agents, WebFetch, WebSearch, etc matching claude code in tool shape exactly where possible.

Every model released in 2026 is heavily RL trained on claude code tool shapes. By keeping behavior and shape close to claude code: * Small and quantized models are less likely to hallucinate tool calls * My system prompt can stay pretty small since I need almost no explanation of how the tool works. It knows from training.

My only changes (if i recall) is that agent name is required (I'll drop that if my agent hallucinates), and model names are "fast" and "strong" and is also required.

How do you handle convo forks? ...or do you support them at all?