Pify

Pify Agent Book

Source-code reading notes for the Pi Agent SDK, in English and Vietnamese.

Source-reading notes for the Pi Agent SDK, published in English and Vietnamese. This edition follows the official Pi 1.0.0 release, reviewed against the exact release commit a13d35a742c6ef8462812a28fbe1d8c8b7431c32 on 2026-10-06. The numbered chapters retain the structure of the original Pi Agent Book, but current upstream code and documentation take precedence when the implementation has changed.

New here? Start with the Quickstart to make a streaming model call. Go straight to the numbered chapters for the architecture and source walkthroughs.

How to read

  • New to Pi: Quickstart first, then chapters in order.
  • Reading for the architecture: chapters 1 through 3 establish the three-layer model and the agent loop. Read the remaining chapters as focused explanations of models, tools, messages, events, context, compaction, and sessions.
  • Building on Pi: the How-to Guides are short task-oriented recipes. Start with Codemode and MCP or Virtual Models for core and Coding Agent capabilities. The separate Durable Agent guide covers the experimental package for long-running work.
  • Looking up an API or env var: the Reference is structured for lookup, not reading.

Technical claims are checked against that pinned revision of the official Pi repository. The 1.0.0 baseline covers six directly verified package families: @earendil-works/pi-ai, @earendil-works/pi-agent-core, @earendil-works/pi-coding-agent, @earendil-works/pi-server, @earendil-works/pi-durable, and @earendil-works/chord. Pi 1.0 stabilizes the core while Durable remains experimental.

Sections

  • Quickstart - make your first streaming model call.
  • Glossary - the terms Pi uses for itself, and how this book uses them.
  • How-to Guides - 11 task-oriented recipes covering tools, model providers, streaming, sessions, prompts, deterministic testing, evaluation, runtime hosting, Codemode/MCP, Virtual Models, and Durable Agent workflows.
  • Reference - package exports, configuration, and environment variables.
  • Chapters - 11 long-form chapters covering the SDK end to end, including testing and evaluation.
  • FAQ - common questions about Pi and this book.
  • Changelog - what changed in this site.

Feedback

On this page