A 17-lesson Python tutorial that builds a Claude Code-like agent harness from scratch, starting with a single loop and bash.
buchidonggua/dg-ai-notes
A bilingual tutorial and source-code walkthrough of the Pi-Agent SDK, with a companion code set and an AI-assistant skill for building agents.
- Stars
- 3,422
- Forks
- 271
- Open issues
- 21
- Last commit
- 2 months ago
What is it?
This repository is a learning resource for Pi-Agent, an open-source SDK for building production AI agents that also underlies the OpenClaw agent product. It is organized into three parts: a source-code walkthrough in 10 chapters covering the three-layer architecture, the agent loop, tool and message systems, event handling, context engineering and session management, published in both TypeScript and Python versions.
A second track is a hands-on guide that builds a data-analysis agent step by step, from environment setup and model integration through system prompts, tool definitions, event listeners and wrapping the agent as a service. Seven companion code projects can be run with npm install. The repository also ships an installable skill for coding assistants that is kept in sync with the tutorial and targets the pi-coding-agent v0.83.0 API.
The content is available as an online book, as Markdown files for local reading, and as a PDF release. The code is MIT licensed and the documentation is CC-BY-SA-4.0.
Key features
- 01Source-code walkthrough of Pi-Agent in 10 chapters, in TypeScript and Python
- 02Step-by-step tutorial that builds a deployable data-analysis agent
- 03Seven runnable companion code projects
- 04Interactive Jupyter notebook for experimenting with the agent loop
- 05Installable skill for coding assistants, tracking the pi-coding-agent v0.83.0 API
Use cases
- Learning how a production agent SDK's loop, tools and sessions are designed
- Building a custom enterprise agent on top of Pi-Agent
- Letting an AI coding assistant write Pi-Agent code from a requirement description
Quick start
- 1
Read the tutorial online
- 2
Download the dg-piagent skill folder into your agent's skills directory
- 3
Install dependencies for the companion code sets
npm install
Things to know
- This is a tutorial and code walkthrough, not a standalone application.
- The README is written mainly in Simplified Chinese.
- Documentation is licensed CC-BY-SA-4.0, which requires derivative works to be shared under the same terms.
Topics
FAQ
- What is dg-ai-notes?
- A bilingual tutorial and source-code walkthrough of the Pi-Agent SDK, with a companion code set and an AI-assistant skill for building agents. This repository is a learning resource for Pi-Agent, an open-source SDK for building production AI agents that also underlies the OpenClaw agent product. It is organized into three parts: a source-code walkthrough in 10 chapters covering the three-layer architecture, the agent loop, tool and message systems, event handling, context engineering and session management, published in both TypeScript and Python versions.
- Is dg-ai-notes free to use? What license does it have?
- dg-ai-notes is open source under the MIT license. Check the license terms before using it in commercial products.
- Is dg-ai-notes still maintained?
- Updated within 6 months. The last commit to dg-ai-notes was on Aug 23, 2026.
- What can I use dg-ai-notes for?
- Learning how a production agent SDK's loop, tools and sessions are designed Building a custom enterprise agent on top of Pi-Agent Letting an AI coding assistant write Pi-Agent code from a requirement description
- How do I install dg-ai-notes?
- Read the tutorial online Download the dg-piagent skill folder into your agent's skills directory Install dependencies for the companion code sets: npm install
- Where can I get dg-ai-notes?
- The source code and installation instructions are on GitHub: https://github.com/buchidonggua/dg-ai-notes
Summary generated by AI from the project's README. GitHub stats refresh daily.
Related projects
A Chinese-language textbook that teaches you to build a Pi-style coding agent step by step across 15 runnable Git checkpoints in TypeScript.
A free, MIT-licensed course of 542 lessons that builds AI engineering concepts from scratch in Python, TypeScript, Rust and Julia.
A step-by-step Go workshop that teaches you to build a coding agent on the Claude API, adding file, shell and search tools one at a time.
A free, step-by-step tutorial for building a Python AI agent with LangChain and LangGraph using free-tier Groq and Gemini models.
A terminal coding agent with built-in LSP, debugger, browser and subagent tools, supporting 60+ model providers.