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 0.85.0 release, reviewed against 107d79f. 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.
  • 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. Code identifiers and package names follow the 0.85.0 @earendil-works/pi-* packages.

Sections

  • Quickstart - make your first streaming model call.
  • Glossary - the terms Pi uses for itself, and how this book uses them.
  • How-to Guides - 8 task-oriented recipes covering tools, model providers, streaming, sessions, prompts, deterministic testing, evaluation, and runtime hosting.
  • 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