A free, open-source Chinese AI course and collection of practical skills covering Claude Code, Codex, OpenClaw, Hermes, prompt engineering, and image, voice and music AI tools.
aa1143/NamiAgent
A Chinese-language tutorial that builds a minimal AI agent from scratch in 11 lessons, with a runnable local agent and browser UI.
- Stars
- 395
- Forks
- 39
- Open issues
- 0
- Last commit
- 8 days ago
What is it?
NamiAgent is a beginner-oriented tutorial for building AI agents from scratch, paired with a small local agent you can run yourself. The core idea it teaches is a while loop: call the model, execute tools, write results back into the context, and call the model again. Lessons start from a roughly 100-line minimal loop and add one capability at a time, including tools, permissions, context management, Skills, MCP, sub-agents, planning, and long-term memory. A final part walks through how Claude Code, Codex and other mainstream agents are structured.
Each lesson directory is a complete, runnable snapshot of the code at that stage, and later lessons include tests that run against a fake model without an API key. The project depends only on the openai Python package and targets any OpenAI-compatible endpoint, defaulting to DeepSeek. Running `python web/app.py` opens a local browser UI that shows each model call, reasoning text, tool invocation, and the full context sent to the model, with confirmation prompts before file writes or commands.
The project is explicitly a teaching codebase rather than a production framework, and its own safety notes warn that the permission model does not defend against deliberate attacks.
Key features
- 01Builds an agent step by step in 11 lessons, each a runnable code snapshot
- 02Supports tools, permission confirmation, context compression and session persistence
- 03Includes MCP client support over stdio and sub-agents with independent context
- 04Browser UI shows each model call, tool call and the full context per turn
- 05Uses any OpenAI-compatible API, defaulting to DeepSeek, with only the openai package as dependency
- 06Lessons 3 onward include tests that run without an API key
Use cases
- Learning how agent loops, tools and context management work from the ground up
- Reading the code side by side with lessons to compare consecutive stages
- Running a small local agent in a dedicated workspace with confirmation prompts
- Studying how commercial coding agents are structured through the included breakdowns
Quick start
- 1
Clone the repository
git clone https://github.com/aa1143/NamiAgent.git - 2
Enter the project and install dependencies
cd NamiAgent && pip install -r requirements.txt - 3
Set your model API key and create the workspace
export API_KEY=你的模型密钥 && export NAMI_WORKSPACE=~/agent-workspace && mkdir -p $NAMI_WORKSPACE - 4
Run the lesson 5 agent
cd lessons/lesson-05 && python agent.py
Things to know
- Requires a model API key; the default is DeepSeek.
- Agent can execute commands and read or write files, so it should run in a dedicated workspace.
- It is a teaching project, not a production-grade agent framework.
- Documentation under docs/ is licensed CC BY-NC 4.0, which is non-commercial.
In collections
Topics
FAQ
- What is NamiAgent?
- A Chinese-language tutorial that builds a minimal AI agent from scratch in 11 lessons, with a runnable local agent and browser UI. NamiAgent is a beginner-oriented tutorial for building AI agents from scratch, paired with a small local agent you can run yourself. The core idea it teaches is a while loop: call the model, execute tools, write results back into the context, and call the model again. Lessons start from a roughly 100-line minimal loop and add one capability at a time, including tools, permissions, context management, Skills, MCP, sub-agents, planning, and long-term memory. A final part walks through how Claude Code, Codex and other mainstream agents are structured.
- Is NamiAgent free to use? What license does it have?
- NamiAgent is open source under the MIT license. Check the license terms before using it in commercial products.
- Is NamiAgent still maintained?
- Actively maintained. The last commit to NamiAgent was on Oct 30, 2026.
- What can I use NamiAgent for?
- Learning how agent loops, tools and context management work from the ground up Reading the code side by side with lessons to compare consecutive stages Running a small local agent in a dedicated workspace with confirmation prompts Studying how commercial coding agents are structured through the included breakdowns
- How do I install NamiAgent?
- Clone the repository: git clone https://github.com/aa1143/NamiAgent.git Enter the project and install dependencies: cd NamiAgent && pip install -r requirements.txt Set your model API key and create the workspace: export API_KEY=你的模型密钥 && export NAMI_WORKSPACE=~/agent-workspace && mkdir -p $NAMI_WORKSPACE Run the lesson 5 agent: cd lessons/lesson-05 && python agent.py
- Where can I get NamiAgent?
- The source code and installation instructions are on GitHub: https://github.com/aa1143/NamiAgent
Summary generated by AI from the project's README. GitHub stats refresh daily.
Related projects
A 17-lesson Python tutorial that builds a Claude Code-like agent harness from scratch, starting with a single loop and bash.
A Chinese-language tutorial collection teaching Claude Code, OpenClaw, Codex and WorkBuddy for AI coding, personal agents and office work, with practice materials.
A Chinese-language tutorial series for installing, configuring and building your own OpenClaw AI assistant, from beginner setup to custom Skills development.
A Chinese translation and study guide for DeepLearning.AI's Agent Skills with Anthropic course, with course notes and code walkthroughs.
A Chinese-language textbook that teaches you to build a Pi-style coding agent step by step across 15 runnable Git checkpoints in TypeScript.