How to Run a Lesson in AI Engineering from Scratch: A Complete Guide
To run a lesson in AI Engineering from Scratch, clone the rohitg00/ai-engineering-from-scratch repository, navigate to the lesson directory under phases/<phase>/<lesson>/, and execute the language-specific entry point (such as python3 code/vectors.py or npm start) as documented in the lesson's docs/en.md file.
The rohitg00/ai-engineering-from-scratch repository provides a comprehensive, hands-on curriculum for learning AI engineering through executable code. Each lesson in AI Engineering from Scratch is self-contained, allowing you to learn theoretical concepts while generating concrete artifacts. Understanding the execution workflow ensures you can verify your environment, run implementations correctly, and capture the generated outputs.
Understanding the Repository Structure
The curriculum organizes content into phases, with each lesson following a consistent three-part directory structure under phases/<phase-slug>/<lesson-slug>/:
docs/en.md– Contains the lesson documentation, mathematical explanations, and precise execution commands.code/– Houses runnable implementations in Python, TypeScript, Rust, or Julia, typically with amain.pyormain.tsentry point.outputs/– Stores generated artifacts such as prompts, skill definitions, or trained models produced by the lesson.
The repository root README.md provides a quick-start table mapping phases to their first lessons and showing the exact commands to run lessons from the root directory.
Prerequisites and Environment Verification
Before running lessons, verify your environment using the pre-flight verification script located in the Setup & Tooling phase. This ensures your system meets the requirements for the curriculum.
Run the verification script from the repository root:
python3 phases/00-setup-and-tooling/01-dev-environment/code/verify.py --route beginner
This script checks for required dependencies and tooling versions. A successful run exits with code 0, indicating your environment is ready for the curriculum. While optional, this step prevents common execution failures by identifying missing prerequisites before you attempt to run a lesson in AI Engineering from Scratch.
Running Your First Lesson
Once verification succeeds, you can execute any lesson. All commands are designed to run relative to the repository root unless the lesson documentation explicitly specifies otherwise.
Running Python Lessons
For Python-based lessons, such as the Linear Algebra Intuition lesson in Phase 1, execute the script directly:
python3 phases/01-math-foundations/01-linear-algebra-intuition/code/vectors.py
This implementation in phases/01-math-foundations/01-linear-algebra-intuition/code/vectors.py demonstrates vector arithmetic and matrix multiplication using custom Vector and Matrix classes:
# From phases/01-math-foundations/01-linear-algebra-intuition/code/vectors.py
class Vector:
def __init__(self, data):
self.data = data
def __add__(self, other):
return Vector([a + b for a, b in zip(self.data, other.data)])
def __repr__(self):
return f"Vector({self.data})"
if __name__ == "__main__":
a = Vector([1, 2, 3])
b = Vector([4, 5, 6])
print(f"a + b = {a + b}")
Running this script produces output demonstrating vector addition and neural-network-layer simulations.
Running TypeScript Lessons
Some lessons, particularly in advanced phases like Capstone Projects, require Node.js 20+ and use npm-based workflows. For example, the Terminal-Native Coding Agent lesson requires you to navigate to the TypeScript directory and install dependencies:
cd phases/19-capstone-projects/01-terminal-native-coding-agent/code/ts
npm install
npm start
The npm start command runs the demo and prints a pass/fail report, while npm test executes the unit test suite. These commands are specified in phases/19-capstone-projects/01-terminal-native-coding-agent/code/ts/README.md.
Locating Documentation and Generated Artifacts
Every lesson includes specific execution instructions in its docs/en.md file, including the exact command syntax and expected behavior. After successfully running a lesson, examine the outputs/ directory for generated artifacts.
For instance, after running the Terminal-Native Coding Agent lesson, the skill definition appears at phases/19-capstone-projects/01-terminal-native-coding-agent/outputs/skill-agent-loop.md. These artifacts serve as concrete deliverables that you can integrate into your own AI projects or LLM prompts.
Summary
- Clone the rohitg00/ai-engineering-from-scratch repository to access all phases and lessons.
- Verify your environment using
phases/00-setup-and-tooling/01-dev-environment/code/verify.pybefore starting. - Navigate to lessons using the path pattern
phases/<phase>/<lesson>/and consultdocs/en.mdfor specific commands. - Execute Python lessons with
python3commands from the root, or TypeScript lessons withnpm startafter installing dependencies. - Collect artifacts from the
outputs/directory for use in your own engineering workflows.
Frequently Asked Questions
Do I need to complete lessons in sequential order?
While the curriculum is organized into progressive phases, individual lessons are self-contained and can be run independently. However, earlier phases establish foundational mathematics and tooling concepts that support the advanced agent engineering and capstone project lessons.
What should I do if the verification script fails?
If phases/00-setup-and-tooling/01-dev-environment/code/verify.py reports missing dependencies or version mismatches, install the required tools (Python 3.x, Node.js 20+, or language-specific packages) as indicated by the script's output. Rerun the verification until it exits with code 0 before proceeding to lesson execution.
How do I choose which programming language to use?
Lessons supporting multiple languages include separate subdirectories under code/ (such as code/py/ or code/ts/). Select the language matching your expertise or project needs. The docs/en.md file in each lesson indicates available language implementations and any specific requirements for each runtime.
Where can I find the files generated after running a lesson?
All lesson artifacts are written to the outputs/ folder within the specific lesson directory. For example, the Terminal-Native Coding Agent writes its skill file to phases/19-capstone-projects/01-terminal-native-coding-agent/outputs/. These files contain the prompts, skills, or model definitions produced by the lesson code and serve as proof of completion.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →