Pi Agent Swarm logo

Pi Agent Swarm

by @caho1

Delegate parallel coding tasks to Pi-configured models through MCP, with persistent sessions and a local monitoring panel.

Install Pi Agent Swarm

Run the project’s own setup commands, in order.

Setup steps from the project

@caho1/pi-agent-swarm installs with its own steps rather than a config we can generate, so these are copied as-is. Follow them in order and run the commands in a terminal. Source: github.com

  1. 1. Install
    pi install npm:@caho1/pi-agent-swarm
    
  2. 2. Install
    npm install -g @caho1/pi-agent-swarm
    
  3. 3. Start the server
    pi-subagents-server
    
  4. 4. Add to Codex
    codex plugin marketplace add "$(npm root -g)/@caho1/pi-agent-swarm/codex-plugin"
    
  5. 5. Add to Codex
    codex plugin add pi-subagents@pi-subagents-local
    
  6. 6. Start the server
    pi-subagents-server --port 7789 --data "$HOME/.codex-pi-subagents-demo"
    

Overview

@caho1/pi-agent-swarm connects Codex and Pi to Pi-configured models through a local MCP service. It can start multiple agents with separate tasks, wait for all or the first to finish, inspect results, send follow-ups, and stop running work. Sessions and agent data are stored locally, while a web panel at 127.0.0.1:7788 shows status, responses, and tool activity. Reach for it when a coding workflow benefits from parallel reviews or delegated tasks using different models and tool presets.

Use cases

  • Run parallel repository reviews for correctness and test coverage
  • Delegate coding tasks to different configured Pi models
  • Inspect agent logs, responses, token usage, and cost
  • Continue an agent with its previous session context
  • Use read-only tools for isolated codebase analysis

Key features

  • Parallel multi-agent execution
  • Per-agent model, directory, thinking level, and tool preset
  • Persistent local sessions and JSONL transcripts
  • Follow-ups and queued messages
  • Local web panel for agent monitoring
  • Codex plugin and Pi extension

Tools7

What Pi Agent Swarm lets your agent do. Expand a tool for its parameters.

Self-reported~147 tokens of context

Security & health

What it can reach and how reliably it runs — from our own checks, not the maintainer’s claims.

ActiveLast checked

Recent health check succeeded.

Adoption & maintenance

Factual signals from GitHub, npm, and our automated checks — not a rating.

npm downloads536Package downloads in the last 30 days.
Last commit1mo agoMost recent push to the default branch.
Tools exposed7Callable tools this server registers over MCP.

How Pi Agent Swarm works

What @caho1/pi-agent-swarm does

@caho1/pi-agent-swarm adds delegated, multi-model subagents to Codex and Pi. The package contains the local service, a Pi extension, a Codex plugin, and a web panel. Agents use models available through the host's Pi configuration, including configured custom providers.

The MCP interface supports creating agents, coordinating their completion, reviewing their output, continuing existing sessions, and stopping active work. Each agent can receive its own task, model, working directory, thinking level, and tool preset. Independent tasks can run concurrently rather than being handled one after another.

How it works

The service listens on 127.0.0.1:7788 by default and exposes the MCP endpoint at /mcp. Codex connects through the included plugin, while Pi can start the service automatically when its extension makes the first tool call. The service remains available after the Pi session ends.

Agent records, session data, and the panel's default model are stored beneath ~/.codex-pi-subagents. Agent transcripts are written as JSONL files under the relevant project's .pi-subagents/agent-transcripts directory. Follow-ups reuse an agent's existing session context; queued messages are delivered if the agent is still running.

The coding preset uses Pi extensions and MCP servers according to Pi's project trust settings. The read-only preset exposes read, grep, find, and ls without loading extensions or MCP tools.

Setup and configuration

The runtime requires Node.js 22.19 or later and a Pi installation with at least one configured model and its credentials. Install the Pi extension with:

sh
pi install npm:@caho1/pi-agent-swarm

For Codex, install the package globally and start the service:

Terminal
npm install -g @caho1/pi-agent-swarm
pi-subagents-server

Then add the package's Codex plugin from the global npm location and restart Codex after changing plugin configuration. The plugin may request approval for MCP calls; its approval mode can be configured in ~/.codex/config.toml.

Pi provider credentials are supplied through Pi's configuration. For example, a DeepSeek setup can provide DEEPSEEK_API_KEY before starting Pi or the service. Use pi_list_models to discover model IDs available to the service.

The standalone service accepts options including --port, --host, --data, --allow-host, --stdio, and --faux. PI_SUBAGENTS_PORT and PI_SUBAGENTS_DATA can set the port and data directory. When using a non-default port with Codex, configure the MCP URL manually.

Tools and capabilities

  • pi_list_models lists models available through Pi.
  • pi_spawn_agent starts an agent with a task and optional model, directory, thinking level, name, and tool preset.
  • pi_wait waits for all selected agents or the first agent to finish. Its default timeout is 120 seconds, with a maximum of 240 seconds.
  • pi_get_agent returns status, the latest answer, recent logs, and usage details.
  • pi_send_followup continues an existing agent session and queues messages sent while the agent is active.
  • pi_abort stops a running agent.
  • pi_list_agents lists agents associated with the current Codex conversation or Pi session.

The local panel displays agent status, responses, and tool activity. It also allows stopping an agent and choosing the default model for new agents.

Limitations and notes

The project has been tested with Pi SDK 1.4 on macOS. Windows and the standalone Pi binary have not been verified. A global npm installation may resolve a newer Pi SDK peer dependency.

The Codex plugin expects the service on port 7788 unless a manual MCP configuration points it elsewhere. Use a separate data directory for each service running on a different port. Agents using in-memory native sessions can retain context only while the service remains running; their transcripts remain available after a restart, but the native session cannot be resumed.

Written by AllMCPs with AI assistance from the project’s README and listing data. How we build listings

Reviews

No reviews yet — be the first to share how it worked for you.

Frequently Asked Questions about Pi Agent Swarm

@caho1/pi-agent-swarm is an MCP server that connects Codex and Pi to models configured through Pi. Its main tools start agents, wait for completion, inspect status and logs, send follow-ups, abort running work, list agents, and list available models.

Install it in Pi with `pi install npm:@caho1/pi-agent-swarm`, or install it globally for Codex with `npm install -g @caho1/pi-agent-swarm` and start `pi-subagents-server`. Codex users must also add the bundled plugin and keep the service running.

It supports models available through the Pi installation, including configured custom providers. Call `pi_list_models` to retrieve the model IDs exposed to the service, then select a model when spawning an agent.

Call `pi_spawn_agent` separately for each independent task, then use `pi_wait` to wait for all selected agents or the first one to finish. Each agent can have its own model, working directory, thinking level, name, and tool preset.

It stores the agent index, session JSONL files, and panel settings under `~/.codex-pi-subagents` by default. Project transcripts are written under `.pi-subagents/agent-transcripts`; optional session settings can use Pi's session directory or in-memory storage.

Related MCP servers

Add a badge to your READMEShow it’s listed — live SVG, Markdown or HTML.

AllMCPs Directory Badge

Full Badge Customizer

Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.

Badge Style:
Live Dynamic SVG PreviewPi Agent Swarm AllMCPs Directory Badge
Markdown (GitHub README)
[![AllMCPs](https://allmcps.com/api/badge/caho1-pi-agent-swarm?style=directory)](https://allmcps.com/mcp/caho1-pi-agent-swarm)
HTML Embed
<a href="https://allmcps.com/mcp/caho1-pi-agent-swarm"><img src="https://allmcps.com/api/badge/caho1-pi-agent-swarm?style=directory" alt="Pi Agent Swarm on AllMCPs" /></a>