npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@agpenton/chain-as-agent

v1.0.23

Published

Chain-as-Agent extension for PI registry enables composable agent workflows

Readme

Chain-as-Agent Extension

A production-ready extension for @tintinweb/pi-subagents that transforms chain workflows into transparent, first-class commands.


Overview

The Chain-as-Agent extension allows you to execute multi-agent chains as native commands. Instead of using:

/run-chain <chain-name> -- <prompt>

You can now invoke chains directly:

/architecture-review -- Analyze repository

Features

  • Native Commands: Chains automatically register as /chain-name commands
  • Backward Compatible: Dual registration preserves /run-chain <chain-names> syntax
  • Streaming Support: Real-time progress callbacks during chain execution
  • Context Compression: Configurable context budget with multiple strategies
  • Checkpoint Persistence: Durable checkpoints with atomic writes and recovery
  • Retry & Observability: Comprehensive metrics collection

Installation

Install via npm

npm install @agpenton/chain-as-agent

Install via PI

pi install npm:@agpenton/chain-as-agent

Quick Start

Basic Chain Execution

Execute a chain directly:

/architecture-review -- Analyze the repository

Chain Discovery

List available chains:

/help
# Shows all registered chain commands

Chain Configuration

Chains are YAML files in .pi/chains/:

# .pi/chains/research.yaml
name: research
displayName: Research Chain
description: Research chain
agents:
   - researcher
   - analyst
context_budget: 5000
on_failure: stop

Chain Configuration

Context Propagation Modes

Chain contexts can propagate differently:

  • inherit: Full context inheritance
  • inherit_compact: Compact context with budget enforcement
  • inherit_prompt_only: Only prompt passed
  • none: No context propagation

Execution Modes

Sequential (on_failure: stop)

All agents execute sequentially. On failure:

/architecture-review -- Analyze repository

Continue on Failure

chains:
  research:
    agents:
      - researcher
      - analyst
    on_failure: continue

Retry Support

Exponential backoff with configurable retries:

await chain.executeWithRetry(chainId, prompt, {
  maxAttempts: 3,
  backoffMultiplier: 2,
  baseDelayMs: 1000
});

Usage Examples

Example Chain Commands

# Architecture review
/architecture-review -- Analyze this repository

# Planning chain
/planning-chain -- Create a project plan

# Research chain
/research-chain -- Research the topic

# Data analysis chain
/data-analysis-chain -- Analyze the dataset

Chain Discovery

# List all chains
/help

# Execute a chain
/architecture-review -- Analyze the project structure

Documentation


Development

Setup

npm install
npm test

Testing

# Run all tests
npm test

# With coverage
npm run test:coverage

# UI test runner
npm run test:ui

Architecture

User
 │
 ▼
/chain-name
 │
 ▼
Command Resolver
 │
 ▼
Chain Agent Adapter
 │
 ▼
Chain Executor
 │
 ▼
@tintinweb/pi-subagents Runtime

Package Metadata

  • Name: @agpenton/chain-as-agent
  • Version: 1.0.0
  • License: MIT
  • Repository: https://github.com/agpenton/chain-as-agent
  • Keywords: pi-agent, chain, agentic-workflow, multi-agent, plugin
  • Peer Dependency: @tintinweb/[email protected]

Non-Goals

  • ❌ No external npm dependencies (uses only built-in Node.js)
  • ❌ No external dependencies (uses only @tintinweb/pi-subagents)
  • ❌ No fork or modification of Tintinweb packages
  • ❌ No breaking changes to existing APIs
  • ❌ No parallel runtime creation

License

MIT License


Compatibility

| PI Version | Chain-as-Agent | |------------|----------------| | @tintinweb/[email protected] | ✅ Supported |


Release

Version: 1.0.0
Status: Production ready
Release Date: 2026-01-15

See RELEASE.md for detailed release notes.


Chain-as-Agent Extension v1.0.0

Publishing