🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

@piotr-oles/pi-subagents

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@piotr-oles/pi-subagents

Pi Agent extension: spawn specialized subagents with isolated sessions

latest
Source
npmnpm
Version
1.0.0
Version published
Weekly downloads
18
-21.74%
Maintainers
1
Weekly downloads
 
Created
Source

pi-subagents

A pi coding agent extension that lets the agent spawn specialized subagents — each running in its own isolated session with its own model, tools, and instructions.

Install

pi install npm:@piotr-oles/pi-subagents

Agent templates

Define agents as markdown files with YAML frontmatter. Two locations are supported:

LocationScope
~/.pi/agent/subagents/<name>.mdGlobal — available in all projects
.pi/subagents/<name>.mdProject — available in current project only

A project template overrides a global template with the same name.

Example .pi/subagents/coder.md:

---
description: Specialist for writing and editing code
model: anthropic/claude-opus-4-5
thinking: low
max_turns: 30
included_tools: bash, read, edit, write
---

You are an expert software engineer. Focus only on the assigned task.
Write clean, well-tested code. Do not ask for clarification — make reasonable assumptions.

Frontmatter fields:

FieldTypeDescription
descriptionstringShort description shown in the UI. Defaults to the filename.
modelstringModel to use (e.g. anthropic/claude-haiku-4-5). Inherits from parent session if omitted.
thinkingstringThinking level: off, minimal, low, medium, high, xhigh.
max_turnsnumberHard turn limit. When reached the agent is given grace turns to wrap up.
grace_turnsnumberExtra turns after max_turns before the agent is force-stopped.
enabledbooleanSet to false to disable this agent type without deleting the file.
included_toolsstringComma-separated list of tool names available to this agent. Omit to inherit all tools from the parent session.
included_skillsstringComma-separated list of skill names available to this agent. Omit to inherit all skills.
included_subagentsstringComma-separated list of subagent template names this agent may spawn.

If no matching template is found the agent falls back to general-purpose, or a plain default if that is also absent.

Tools

subagent

Spawns a subagent to handle a task, or follows up on a previously completed one.

ParameterTypeDescription
namestringName of the agent template to use. Required for both spawn and follow-up.
idstringID of a done subagent to follow-up. Omit when spawning fresh.
descriptionstringShort description of the task (shown in UI).
promptstringTask prompt sent to the subagent.

Blocks until the subagent completes and returns its result inline. To follow up on a finished subagent, call subagent again with the id returned in the previous result plus a new prompt.

How it works

  • On before_agent_start, templates are reloaded from disk.
  • When subagent is called, the extension resolves the template, builds an AgentConfig, and starts an isolated pi session.
  • The subagent session inherits the parent's model registry and working directory but gets its own system prompt built from the template's instructions.
  • The subagent tool is excluded from subagent sessions unless included_subagents is set — only then can a subagent spawn further subagents (limited to the listed templates).
  • A concurrency queue limits how many agents run simultaneously; excess agents are queued and started as slots free up.

Flags

pi --pi-subagents-max-concurrent 4    # max agents running at once (default: 4)

Or via environment variable:

PI_SUBAGENTS_MAX_CONCURRENT=2 pi

subagent:templates command

Opens an interactive menu listing all loaded agent templates with their source (global / project ) and model. Run via the pi command palette.

Development

pnpm install
pnpm test
pnpm typecheck
pnpm check

To test changes manually, pass the source entry point directly to pi:

pi -ne -e packages/pi-subagents/src/index.ts

Keywords

pi-package

FAQs

Package last updated on 23 Jun 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts