pi-coding-agent-sdk

Implements Pi coding-agent SDK integrations and extensions within the Workbench RPC boundary.

2|Updated Aug 17, 2026
One-click install
npx skills add https://github.com/yyy0107/pi-workbench --skill pi-coding-agent-sdk-yyy0107
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: pi-coding-agent-sdk
Source: https://github.com/yyy0107/pi-workbench/tree/main/.agents/skills/pi-coding-agent-sdk
Command: npx skills add https://github.com/yyy0107/pi-workbench --skill pi-coding-agent-sdk-yyy0107

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires @earendil-works/pi-coding-agent, and includes references (resource) components.

What problem does it solve? Integrating the embedded Pi coding-agent SDK into Workbench requires choosing the correct public API surface, extension lifecycle hooks, and session construction path while keeping Pi runtime objects off the browser; mistakes cause version mismatches, leaked runtime objects, and broken extension lifecycles. ## Core Features & Use Cases - Versioned API Resolution: Verifies the installed @earendil-works/pi-coding-agent package declarations and public root exports before writing any import. - Extension Authoring Guidance: Covers ExtensionFactory, InlineExtension, event selection, tool registration, and bounded tool output with truncation and file spill patterns. - Session Construction & Binding: Directs use of createAgentSessionServices(), createAgentSessionFromServices(), and session.bindExtensions() in RPC mode. - Use Case: When adding a Workbench feature that registers a custom Pi tool or reacts to session lifecycle events, this Skill routes you to the correct SDK layer, the owning server module, and the proportional validation steps. ## Quick Start Use the pi-coding-agent-sdk skill to implement a Pi coding-agent SDK integration for this Workbench feature.

Frequently Asked Questions about pi-coding-agent-sdk

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

FAQPage Schema
How do I create a Pi coding-agent session in Workbench?▼

Use createAgentSessionServices() to resolve cwd-bound settings, models, and resources, then createAgentSessionFromServices() with the existing SessionManager. Afterward call session.bindExtensions() with mode "rpc" and the host-provided UI context.

When should I use customTools versus extensionFactories in the Pi SDK?▼

Use customTools for a fixed host-owned tool definition or same-name execution override without lifecycle hooks. Use extensionFactories with pi.registerTool() when the tool belongs to a broader extension, depends on events, or changes availability dynamically.

Can I import Pi SDK types from dist/core deep paths?▼

No. The published package only supports root imports from @earendil-works/pi-coding-agent; declarations under dist/core/** are for inspection only. Confirm every symbol is exported from the package root of the installed version.

How do I prevent oversized tool output in Pi extensions?▼

Select fields or paginate at the source, then apply the SDK's truncateHead/truncateTail utilities with the 50 KiB and 2,000 line defaults. Retain complete results through a readable file with 0600 permissions and return a bounded JSON summary with the path.

Why must Pi runtime objects stay out of the Workbench browser code?▼

AgentSession, ExtensionAPI, registries, and callbacks are Node runtime objects that cannot be serialized. The browser must consume stable JSON-compatible Workbench RPC and stream contracts exposed by the server adapter instead.