@e9n/pi-subagent

extensionmaintained

Parallel task delegation for pi — spawn isolated subagents for single, parallel, and chain execution

by · v0.1.0 · published 5mo ago

$ pi install npm:@e9n/pi-subagent
downloads/mo
77
stars
114
last push
2d ago
open issues
4

Signals

license: MITtestspi manifest: missinginstall size: —deps: 0peer deps: 0

Download trend

153 downloads · last 12 weeks (weekly)

README

@e9n/pi-subagent

Parallel task delegation extension for pi. Spawn isolated pi subprocesses for single, parallel, chain, orchestrator, and pool-based agent workflows.

Features

  • Single — delegate one task to a named agent subprocess
  • Parallel — run multiple independent tasks concurrently; results stream back as they complete
  • Chain — pipeline tasks where each step receives the previous output via {previous}
  • Orchestrator — hierarchical agent trees where agents spawn and message each other autonomously
  • Pool — long-lived agents with persistent context; send follow-up messages without losing state
  • Agent discovery — reads agent definitions from ~/.pi/agent/agents/*.md and .pi/agents/*.md
  • Extension isolation — subagents run with --no-extensions by default; whitelist only what's needed
  • System prompt injection — injects available agents and usage patterns into the LLM context automatically
  • Bundled skill — includes skill definitions for agent orchestration patterns

Setup

Add to ~/.pi/agent/settings.json or .pi/settings.json:

{
  "pi-subagent": {
    "maxConcurrent": 4,
    "maxTotal": 8,
    "timeoutMs": 600000,
    "model": null,
    "extensions": [],
    "blockedExtensions": []
  }
}
KeyDefaultDescription
maxConcurrent4Max subagents running in parallel
maxTotal8Max total subagents per session
timeoutMs600000Subprocess timeout in ms (10 min)
modelnullModel override for all subagents (null = use default)
extensions[]Extension paths whitelisted for all subagents
blockedExtensions[see below]Extensions subagents can never load. Default: pi-webserver, pi-cron, pi-heartbeat, pi-channels, pi-web-dashboard, pi-telemetry. pi-subagent is always blocked.

Tool: subagent

Delegate tasks to isolated pi subprocesses. Choose a mode by supplying the matching parameter.

Modes

ModeHow to invokeDescription
Single{ agent, task }Run one agent on one task
Parallel{ tasks: [{agent, task}, …] }Run multiple tasks concurrently
Chain{ chain: [{agent, task}, …] }Pipeline — each step gets {previous} output
Orchestrator{ orchestrator: {agent, task} }Root agent spawns and manages sub-agents autonomously
Pool: spawn{ action: "spawn", id, agent, task }Start a persistent agent
Pool: send{ action: "send", id, message }Send a follow-up message to a pool agent
Pool: list{ action: "list" }List all active pool agents
Pool: kill{ action: "kill", id }Kill a pool agent and its children
Pool: kill-all{ action: "kill-all" }Tear down entire pool

Key Parameters

ParameterTypeDescription
agentstringAgent name (from discovered .md definitions)
taskstringTask prompt for the subagent
modelstringModel override for this invocation
thinkingstringThinking budget: off, minimal, low, medium, high, xhigh
extensionsstring[]Extra extension paths to whitelist for this invocation
noToolsbooleanRun without file/bash tools
agentScopestringAgent discovery scope: user, project, or both

Events

EventPayloadDescription
subagent:start{ agent, task, trackingId }Fired when a subprocess is spawned
subagent:complete{ agent, trackingId, status, tokens, cost, durationMs }Fired when a subprocess finishes

Install

pi install npm:@e9n/pi-subagent

License

MIT