Skip to content

Commit c6a27ef

Browse files
CrazyBoyMCrazyBoyM
authored andcommitted
feat: build an AI agent from 0 to 1 -- 11 progressive sessions
- 11 sessions from basic agent loop to autonomous teams - Python MVP implementations for each session - Mental-model-first docs in en/zh/ja - Interactive web platform with step-through visualizations - Incremental architecture: each session adds one mechanism
0 parents  commit c6a27ef

156 files changed

Lines changed: 28059 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.env.example

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# API Key (required)
2+
# Get yours at: https://console.anthropic.com/
3+
ANTHROPIC_API_KEY=sk-ant-xxx
4+
5+
# Model ID (required)
6+
MODEL_ID=claude-sonnet-4-6
7+
8+
# Base URL (optional, for Anthropic-compatible providers)
9+
# ANTHROPIC_BASE_URL=https://api.anthropic.com
10+
11+
# =============================================================================
12+
# Anthropic-compatible providers
13+
#
14+
# Provider MODEL_ID SWE-bench TB2 Base URL
15+
# --------------- -------------------- --------- ------ -------------------
16+
# Anthropic claude-sonnet-4-6 79.6% 59.1% (default)
17+
# MiniMax MiniMax-M2.5 80.2% - see below
18+
# GLM (Zhipu) glm-5 77.8% - see below
19+
# Kimi (Moonshot) kimi-k2.5 76.8% - see below
20+
# DeepSeek deepseek-chat 73.0% - see below
21+
# (V3.2)
22+
#
23+
# SWE-bench = SWE-bench Verified (Feb 2026)
24+
# TB2 = Terminal-Bench 2.0 (Feb 2026)
25+
# =============================================================================
26+
27+
# ---- International ----
28+
29+
# MiniMax https://www.minimax.io
30+
# ANTHROPIC_BASE_URL=https://api.minimax.io/anthropic
31+
# MODEL_ID=MiniMax-M2.5
32+
33+
# GLM (Zhipu) https://z.ai
34+
# ANTHROPIC_BASE_URL=https://api.z.ai/api/anthropic
35+
# MODEL_ID=glm-5
36+
37+
# Kimi (Moonshot) https://platform.moonshot.ai
38+
# ANTHROPIC_BASE_URL=https://api.moonshot.ai/anthropic
39+
# MODEL_ID=kimi-k2.5
40+
41+
# DeepSeek https://platform.deepseek.com
42+
# ANTHROPIC_BASE_URL=https://api.deepseek.com/anthropic
43+
# MODEL_ID=deepseek-chat
44+
45+
# ---- China mainland ----
46+
47+
# MiniMax https://platform.minimax.io
48+
# ANTHROPIC_BASE_URL=https://api.minimaxi.com/anthropic
49+
# MODEL_ID=MiniMax-M2.5
50+
51+
# GLM (Zhipu) https://open.bigmodel.cn
52+
# ANTHROPIC_BASE_URL=https://open.bigmodel.cn/api/anthropic
53+
# MODEL_ID=glm-5
54+
55+
# Kimi (Moonshot) https://platform.moonshot.cn
56+
# ANTHROPIC_BASE_URL=https://api.moonshot.cn/anthropic
57+
# MODEL_ID=kimi-k2.5
58+
59+
# DeepSeek (no regional split, same endpoint globally)
60+
# ANTHROPIC_BASE_URL=https://api.deepseek.com/anthropic
61+
# MODEL_ID=deepseek-chat

.github/workflows/ci.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
defaults:
13+
run:
14+
working-directory: web
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- uses: actions/setup-node@v4
20+
with:
21+
node-version: 20
22+
cache: npm
23+
cache-dependency-path: web/package-lock.json
24+
25+
- name: Install dependencies
26+
run: npm ci
27+
28+
- name: Type check
29+
run: npx tsc --noEmit
30+
31+
- name: Build
32+
run: npm run build

.github/workflows/test.yml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: Test
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
unit-test:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v6
14+
15+
- name: Set up Python
16+
uses: actions/setup-python@v6
17+
with:
18+
python-version: "3.11"
19+
20+
- name: Install dependencies
21+
run: pip install anthropic python-dotenv
22+
23+
- name: Run unit tests
24+
run: python tests/test_unit.py
25+
26+
session-test:
27+
runs-on: ubuntu-latest
28+
strategy:
29+
matrix:
30+
session: [v0, v1, v2, v3, v4, v5, v6, v7, v8a, v8b, v8c, v9]
31+
steps:
32+
- uses: actions/checkout@v6
33+
34+
- name: Set up Python
35+
uses: actions/setup-python@v6
36+
with:
37+
python-version: "3.11"
38+
39+
- name: Install dependencies
40+
run: pip install anthropic python-dotenv
41+
42+
- name: Run ${{ matrix.session }} tests
43+
env:
44+
TEST_API_KEY: ${{ secrets.TEST_API_KEY }}
45+
TEST_BASE_URL: ${{ secrets.TEST_BASE_URL }}
46+
TEST_MODEL: ${{ secrets.TEST_MODEL }}
47+
run: python tests/test_${{ matrix.session }}.py
48+
49+
web-build:
50+
runs-on: ubuntu-latest
51+
defaults:
52+
run:
53+
working-directory: web
54+
steps:
55+
- uses: actions/checkout@v6
56+
57+
- name: Set up Node.js
58+
uses: actions/setup-node@v4
59+
with:
60+
node-version: "20"
61+
cache: "npm"
62+
cache-dependency-path: web/package-lock.json
63+
64+
- name: Install dependencies
65+
run: npm ci
66+
67+
- name: Build
68+
run: npm run build

.gitignore

Lines changed: 223 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,223 @@
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[codz]
4+
*$py.class
5+
6+
# C extensions
7+
*.so
8+
9+
# Distribution / packaging
10+
.Python
11+
build/
12+
develop-eggs/
13+
dist/
14+
downloads/
15+
eggs/
16+
.eggs/
17+
/lib/
18+
/lib64/
19+
parts/
20+
sdist/
21+
var/
22+
wheels/
23+
share/python-wheels/
24+
*.egg-info/
25+
.installed.cfg
26+
*.egg
27+
MANIFEST
28+
29+
# PyInstaller
30+
# Usually these files are written by a python script from a template
31+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
32+
*.manifest
33+
*.spec
34+
35+
# Installer logs
36+
pip-log.txt
37+
pip-delete-this-directory.txt
38+
39+
# Unit test / coverage reports
40+
htmlcov/
41+
.tox/
42+
.nox/
43+
.coverage
44+
.coverage.*
45+
.cache
46+
nosetests.xml
47+
coverage.xml
48+
*.cover
49+
*.py.cover
50+
.hypothesis/
51+
.pytest_cache/
52+
cover/
53+
54+
# Translations
55+
*.mo
56+
*.pot
57+
58+
# Django stuff:
59+
*.log
60+
local_settings.py
61+
db.sqlite3
62+
db.sqlite3-journal
63+
64+
# Flask stuff:
65+
instance/
66+
.webassets-cache
67+
68+
# Scrapy stuff:
69+
.scrapy
70+
71+
# Sphinx documentation
72+
docs/_build/
73+
74+
# PyBuilder
75+
.pybuilder/
76+
target/
77+
78+
# Jupyter Notebook
79+
.ipynb_checkpoints
80+
81+
# IPython
82+
profile_default/
83+
ipython_config.py
84+
85+
# pyenv
86+
# For a library or package, you might want to ignore these files since the code is
87+
# intended to run in multiple environments; otherwise, check them in:
88+
# .python-version
89+
90+
# pipenv
91+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
93+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
94+
# install all needed dependencies.
95+
#Pipfile.lock
96+
97+
# UV
98+
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
99+
# This is especially recommended for binary packages to ensure reproducibility, and is more
100+
# commonly ignored for libraries.
101+
#uv.lock
102+
103+
# poetry
104+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
105+
# This is especially recommended for binary packages to ensure reproducibility, and is more
106+
# commonly ignored for libraries.
107+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
108+
#poetry.lock
109+
#poetry.toml
110+
111+
# pdm
112+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
113+
# pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
114+
# https://pdm-project.org/en/latest/usage/project/#working-with-version-control
115+
#pdm.lock
116+
#pdm.toml
117+
.pdm-python
118+
.pdm-build/
119+
120+
# pixi
121+
# Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
122+
#pixi.lock
123+
# Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
124+
# in the .venv directory. It is recommended not to include this directory in version control.
125+
.pixi
126+
127+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
128+
__pypackages__/
129+
130+
# Celery stuff
131+
celerybeat-schedule
132+
celerybeat.pid
133+
134+
# SageMath parsed files
135+
*.sage.py
136+
137+
# Environments
138+
.env
139+
.envrc
140+
.venv
141+
env/
142+
venv/
143+
ENV/
144+
env.bak/
145+
venv.bak/
146+
147+
# Spyder project settings
148+
.spyderproject
149+
.spyproject
150+
151+
# Rope project settings
152+
.ropeproject
153+
154+
# mkdocs documentation
155+
/site
156+
157+
# mypy
158+
.mypy_cache/
159+
.dmypy.json
160+
dmypy.json
161+
162+
# Pyre type checker
163+
.pyre/
164+
165+
# pytype static type analyzer
166+
.pytype/
167+
168+
# Cython debug symbols
169+
cython_debug/
170+
171+
# PyCharm
172+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
173+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
174+
# and can be added to the global gitignore or merged into this file. For a more nuclear
175+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
176+
#.idea/
177+
178+
# Abstra
179+
# Abstra is an AI-powered process automation framework.
180+
# Ignore directories containing user credentials, local state, and settings.
181+
# Learn more at https://abstra.io/docs
182+
.abstra/
183+
184+
# Visual Studio Code
185+
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
186+
# that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
187+
# and can be added to the global gitignore or merged into this file. However, if you prefer,
188+
# you could uncomment the following to ignore the entire vscode folder
189+
# .vscode/
190+
191+
# Transcripts (generated by compression agent)
192+
.transcripts/
193+
194+
# Runtime artifacts (generated by agent tests)
195+
.task_outputs/
196+
.tasks/
197+
.teams/
198+
199+
# Ruff stuff:
200+
.ruff_cache/
201+
202+
# PyPI configuration file
203+
.pypirc
204+
205+
# Cursor
206+
# Cursor is an AI-powered code editor. `.cursorignore` specifies files/directories to
207+
# exclude from AI features like autocomplete and code analysis. Recommended for sensitive data
208+
# refer to https://docs.cursor.com/context/ignore-files
209+
.cursorignore
210+
.cursorindexingignore
211+
212+
# Marimo
213+
marimo/_static/
214+
marimo/_lsp/
215+
__marimo__/
216+
217+
# Web app
218+
web/node_modules/
219+
web/.next/
220+
web/out/
221+
.vercel
222+
.env*.local
223+
test_providers.py

0 commit comments

Comments
 (0)