pi-multiagents-v2

Codex Multi-Agent V2-style hierarchical subagents for Pi

Packages

Package details

extension

Install pi-multiagents-v2 from npm and Pi will load the resources declared by the package manifest.

$ pi install npm:pi-multiagents-v2
Package
pi-multiagents-v2
Version
0.1.2
Published
Sep 2, 2026
Downloads
441/mo · 158/wk
Author
youngseokchoi
License
MIT
Types
extension
Size
43.1 KB
Dependencies
0 dependencies · 5 peers
Pi manifest JSON
{
  "extensions": [
    "./extensions/index.ts"
  ]
}

Security note

Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.

README

pi-multiagents-v2

A Pi extension implementing the core behavior of Codex Multi-Agent V2 with in-process AgentSession instances.

No markdown-backed agents are needed or configured by default.

Features

  • Hierarchical task paths (/root/research/api)
  • Recursive subagent spawning
  • Independent context windows with fork_turns: "none" | "all" | "N"
  • Shared working directory and filesystem
  • Asynchronous agent mailboxes and automatic final-answer delivery
  • Persistent child context for follow-up tasks
  • Configurable child-run concurrency (PI_MULTIAGENTS_MAX_CONCURRENCY, default 8)
  • Inherited model, reasoning level, active tools, extensions, skills, and context files

Tools

  • spawn_agent
  • send_message
  • followup_task
  • wait_agent
  • list_agents
  • interrupt_agent

Install

pi install npm:pi-multiagents-v2
# or install directly from GitHub
pi install git:github.com/YoungseokCh/pi-multiagents-v2

Or test without installing:

pi -e git:github.com/YoungseokCh/pi-multiagents-v2

Notes

Agents share a filesystem, so delegated coding tasks should use disjoint write scopes.

This is a behavioral port inspired by OpenAI Codex Multi-Agent V2, with these differences:

  • Uses Pi AgentSession instances instead of Codex's Rust ThreadManager
  • Copies messages for context forks instead of forking native Codex rollouts
  • Does not restore the agent tree after reload, session replacement, or process restart
  • Approximates Codex's scheduling, prompts, schemas, and edge-case behavior

Changelog

v0.1.2

  • Persist named child sessions under persisted parents, linked through parentSession for native /resume and /tree inspection.
  • Keep child sessions in-memory when the parent session is ephemeral.
  • Hide inter-agent mailbox envelopes from the root transcript while retaining them in model context.
  • Await final-answer delivery before releasing a child run.
  • Match Codex's TUI behavior by hiding list_agents and rendering wait_agent as waiting/finished lifecycle status.

Child-session navigation is intended after the team finishes because switching sessions shuts down an active team.

References