Pi 0.83 · bilingual source-guided course

Start with one reply.
Build a complete desktop agent.

Learn through visible product goals, then follow each behavior into Pi’s real source call chain.

37-chapter curriculum · source baseline Pi v0.83.0 · English edition in progress

Course map

Grow the product one capability at a time.

01

Make the desktop agent speak

  1. 1
    The desktop agent’s first answer

    Meet pi-ai, providers, models, and context through one minimal model call.

    Overview
  2. 2
    Stream the answer token by token

    Understand AssistantMessageEventStream and streaming events.

    Overview
  3. 3
    Show thinking, tokens, and errors

    Turn model internals into states a desktop application can display.

    Overview
  4. 4
    Let users switch models

    Understand providers, the model catalog, authentication, and cross-provider compatibility.

    Overview
02

Move beyond chat

  1. 5
    Let the agent inspect the desktop

    Learn ToolCall and ToolResult by building a file-information tool.

    Overview
  2. 6
    Why an agent loop is necessary

    Connect model decisions, tool execution, and returned results into a loop.

    Overview
  3. 7
    Show tool progress in the UI

    Map agent events to clear, observable interface states.

    Overview
  4. 8
    Parallel tools, cancellation, and recovery

    Handle concurrent execution, aborts, errors, and stopping conditions.

    Overview
  5. 9
    Require confirmation for dangerous actions

    Define permission, approval, trust, and sandbox boundaries.

    Overview
03

Give the agent memory

  1. 10
    What a multi-turn conversation stores

    Separate agent messages, LLM messages, UI messages, and context.

    Overview
  2. 11
    Save and restore sessions

    Understand sessions, entries, repositories, and persistence.

    Overview
  3. 12
    Why a session is a tree

    Learn forks, branches, and retrying from a historical node.

    Overview
  4. 13
    When the conversation grows too long

    Understand overflow, cut points, summaries, and compaction records.

    Overview
  5. 14
    Redirect an agent while it runs

    Use steering, follow-ups, and queues to control active work.

    Overview
04

System prompts and context engineering

  1. 15
    A system prompt is not static text

    Understand dynamic prompts, project context, and resource merging.

    Overview
05

Skills: reusable expertise

  1. 16
    Why agents need Skills

    Distinguish Skills, tools, system prompts, and Extensions.

    Overview
  2. 17
    Create your first Skill

    Build a runnable error-log analysis Skill.

    Overview
  3. 18
    How Skills are discovered and loaded

    Trace directory scans, frontmatter parsing, and conflict diagnostics.

    Overview
  4. 19
    How Skills are invoked

    Understand explicit invocation, automatic matching, and progressive loading.

    Overview
  5. 20
    Design high-quality Skills

    Create Skills that are discoverable, executable, verifiable, and safe.

    Overview
  6. 21
    Test, distribute, and govern Skills

    Cover tests, package distribution, conflicts, and security governance.

    Overview
06

Extensions: change how Pi runs

  1. 22
    Why Pi needs Extensions

    Use tool approval to understand event-driven extension.

    Overview
  2. 23
    The complete Extension loading path

    Trace discovery, module loading, factory registration, and runtime binding.

    Overview
  3. 24
    Extension API and runtime mechanics

    Understand registration, execution, and AgentSession bindings.

    Overview
  4. 25
    The event system and interception chain

    Follow observation, modification, and blocking events through one request.

    Overview
  5. 26
    Add and wrap tools with Extensions

    Understand tool definitions, wrappers, approval, and auditing.

    Overview
  6. 27
    Change agent behavior with Extensions

    Choose extension points for prompts, input, models, compaction, and sessions.

    Overview
  7. 28
    Advanced Extensions: providers and resources

    Extend models, authentication, Skills, resources, sandboxes, and services.

    Overview
  8. 29
    Build reliable Extensions

    Handle errors, cancellation, conflicts, reloads, concurrency, and compatibility.

    Overview
07

Embed Pi in a desktop agent

  1. 30
    Choose the right integration layer

    Compare pi-ai, agent-core, the harness, SDK, and RPC.

    Overview
  2. 31
    Embed Pi with the SDK

    Organize an application with AgentSession, services, and runtime components.

    Overview
  3. 32
    Isolate the agent with RPC

    Design the event protocol between a desktop process and a Pi child process.

    Overview
  4. 33
    Design desktop-agent application state

    Map conversation, streaming, tools, permissions, and sessions into UI state.

    Overview
08

Put the complete system together

  1. 34
    Assemble a complete desktop agent

    Connect chat, tools, memory, Skills, and Extensions.

    Overview
  2. 35
    Trace the full source call chain

    Follow input through model output, tool execution, and session persistence.

    Overview
  3. 36
    Production readiness and testing

    Complete security, recovery, evaluation, diagnostics, packaging, and upgrade checks.

    Overview
  4. 37
    Upgrade to Pi 0.83

    Learn the new capabilities, TypeBox breaking changes, and a verifiable migration path.

    Full chapter