pi-mono-master
Build AI Agents Step by Step

A progressive tutorial for building AI agents with pi-coding-agent.

pi-mono-masterpi-mono-master
👋

01 - Hello Agent

Create a minimal agent — one prompt, one response, exit.

02 - Streaming

Real-time typewriter-style output with event subscriptions.

🛠️

03 - Custom Tools

Define your own tools with TypeBox parameter schemas.

💾

04 - Session Persistence

Save and resume conversations using JSONL session files.

05 - Confirmation Pattern

Block tool execution until the user explicitly confirms.

🧠

06 - System Prompt & Skills

Control agent behavior with system prompts and skill files.

📂

07 - Multi-Session

Manage multiple conversation sessions — list, create, switch.

🚀

08 - Full CLI Agent

The grand finale — a complete, production-quality CLI agent.

📖
8
Chapters
📄
15+
Source Files
🧩
5
Core Patterns
🤖
4
AI Providers

Framework Comparison

How pi-coding-agent stacks up against other popular AI agent frameworks.

Featurepi-coding-agentVercel AI SDKLangChainCrewAIOpenAI Agents SDKMastra
TypeScript-first🟡
Streaming Events
Tool / Function Call
Session Persistence
Multi-Provider
Built-in Coding Tools
Skill / Plugin System
Human-in-the-Loop
Multi-Agent
GUI / Studio

Supported   🟡 Partial   Not built-in

Concept Coverage

Each chapter progressively introduces new patterns. Chapter 08 combines them all.

ConceptCh01Ch02Ch03Ch04Ch05Ch06Ch07Ch08
createAgentSession
Streaming / Events
·
·
·
·
Custom Tools
·
·
·
·
Session Persistence
·
·
·
·
·
Confirmation Pattern
·
·
·
·
·
·
System Prompt
·
·
·
·
·
·
Skills Loading
·
·
·
·
·
·
Multi-Session
·
·
·
·
·
·
Coding Tools
·
·
·
·
·
·
·
Abort / DeltaBatcher
·
·
·
·
·
·
·

Tech Stack

The tools and libraries used throughout this tutorial.

Core
pi-coding-agent
Agent framework — sessions, tools, resources, streaming
AI
pi-ai
Model abstraction — Anthropic, OpenAI, Google, DeepSeek
Schema
TypeBox
JSON Schema builder for tool parameter definitions
Language
TypeScript
Strict mode, ESM, top-level await
Runtime
Bun + tsx
Fast runtime and TypeScript execution
Storage
JSONL Sessions
Line-delimited JSON for persistent conversation storage