pi-graph

Build and run explicit-state multi-agent workflow graphs for the Pi agent harness.

4|1|Updated Jul 21, 2026
One-click install
npx skills add https://github.com/huang-sh/pi-graph --skill pi-graph-huang-sh
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: pi-graph
Source: https://github.com/huang-sh/pi-graph/tree/main/skills/pi-graph
Command: npx skills add https://github.com/huang-sh/pi-graph --skill pi-graph-huang-sh

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Coordinating multiple specialized AI agents — parallel researchers, persistent coders, independent reviewers, human approvers — inside a single agent loop loses context isolation, auditability, and failure recovery. This Skill lets you author, validate, run, and resume pi-graph JSON definitions that orchestrate multi-agent workflows with explicit state, typed handoffs, and durable checkpoints. ## Core Features & Use Cases - Graph authoring with three context modes: Choose isolated, thread, or shared context per agent node to control memory, independence, and auditability across loops. - Schema-validated handoffs and routing: Enforce JSON schemas on agent outputs, define conditional edges, fan-out/barrier patterns, and reducers for parallel write conflicts. - Durable runs with human gates: Pause at human approval nodes, resume from checkpoints, inspect run state, and recover from failures with retry and routing strategies. - Use Case: Design a research-review workflow where parallel researchers fan out, a thread-mode writer drafts iteratively, and an isolated reviewer rejects and routes work back until approved. ## Quick Start Ask the AI to design and validate a pi-graph JSON for a research-and-review workflow with a human approval gate, then run it with a task description.

Frequently Asked Questions about pi-graph

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I build a multi-agent workflow with pi-graph?▼

Author a schemaVersion 2 JSON graph defining agent nodes with context modes, edges for control flow, and response schemas for handoffs. Validate it with /pig validate, then run it with /pig run followed by your task text or JSON input.

When should I use a multi-agent graph instead of a single agent loop?▼

Use a graph only when the task needs distinct specialties, parallelism, an independent reviewer, persistent role memory, typed handoffs, human approval gates, or failure isolation. For ordinary tasks, a single Pi agent loop is simpler and preferred.

What is the difference between isolated, thread, and shared context modes?▼

Isolated mode gives nodes no private memory, suiting reviewers and parallel branches. Thread mode reopens a private session history per threadKey for roles persisting across loops. Shared mode appends role-tagged messages to graph state for an auditable conversation.

How do I resume a pi-graph run paused at a human approval node?▼

A human node pauses the run and returns an interrupt with a runId. Resume it using /pig resume <runId> with the user's answer as a value or JSON, or call the pi_graph_resume tool with the runId and value.

Why does a pi-graph run fail when parallel nodes write the same state path?▼

Parallel nodes writing the same path without a configured reducer cause the run to fail. Add a reducer such as collect, append, or merge to the path; use collect for current-round fan-in results in refinement loops.

What are the limitations of pi-graph checkpoints and readOnly nodes?▼

Checkpoints are at-least-once, so external side effects are not exactly-once. readOnly is a tool allowlist, not an OS sandbox, so high-risk execution should run in a container.