ai-engineering-from-scratch: 523 Hands-On Lessons from Raw Math to Agent Swarms and MCP
An in-depth guide to ai-engineering-from-scratch, an MIT-licensed free open-source curriculum spanning 20 phases and 523 lessons that builds AI systems by hand
'ai-engineering-from-scratch' (GitHub: rohitg00/ai-engineering-from-scratch, official site: aiengineeringfromscratch.com), an open-source educational project created by Rohit Ghumare (@rohitg00), has rapidly gained traction across the developer community and X discussions (including highlights by @RoundtableSpace). Having surpassed 50,000 to 60,000 GitHub stars, the repository delivers a comprehensive, MIT-licensed open-source curriculum structured across 20 phases, 523 lessons, and approximately 342 hours of practical engineering training—spanning from fundamental mathematics up to autonomous agent swarms.

Image source: rohitg00 / GitHub
While conventional AI tutorials often lean toward superficial high-level API consumption or isolated mathematical proofs, ai-engineering-from-scratch focuses on bridging the structural divide between using AI tools and engineering production systems. The curriculum addresses a gap highlighted in the repository's introduction: while roughly 84% of students already use AI tools, only 18% feel professionally prepared to use them in practice. The project bridges this gap by guiding learners to implement core algorithms from foundational math entirely by hand, resulting in real, deployable code at every step.
Hierarchical Structure of 20 Phases and 523 Lessons: From Foundational Math to Autonomous Swarms
The primary architectural strength of ai-engineering-from-scratch lies in its rigorous, progressive layering across all 20 phases and 523 lessons.
- Raw Mathematical Derivation Preceding Frameworks: Foundational concepts—including linear algebra, calculus, backpropagation, and loss functions—are derived and coded from scratch without external deep learning libraries. Frameworks such as PyTorch are introduced only after the underlying mechanics are understood, enabling engineers to comprehend what abstraction layers actually execute under the hood.
- LLM Engineering and Tokenizer Construction (Phases 10–11): Learners build custom tokenizers and self-attention mechanisms by hand, establishing a firm grasp of transformer architectures, prompt engineering pipelines, and production LLM engineering.
- Tool Protocols and Agent Skills (Phase 13): Covers modern integration standards, including Model Context Protocol (MCP) server development and Agent Skills, teaching developers how to interface external tools, databases, and APIs securely with LLM backends.
- Autonomous Multi-Agent Orchestration (Phases 14–16): Transitions from single-turn prompts to robust multi-agent systems. The curriculum implements industry-standard coordination patterns in code: supervisor-worker hierarchies, peer-to-peer swarms, hierarchical delegation, and debate-driven multi-agent consensus.
'Runnable Artifacts' Practical Loop and Multi-Language Support
Rather than relying on passive reading or theoretical exercises, the curriculum enforces an active build-and-verify workflow for every single lesson.
- Ship a Runnable Artifact: Every individual lesson requires learners to build a concrete, reusable deliverable: a prompt template, an agent skill, an autonomous agent, or an MCP server. The learning cycle follows a standardized loop: review lesson concept → implement source code → execute directly from repository root → capture and preserve verification evidence.
- Four Programming Languages Supported: Implementation examples and starter kits are provided across Python, TypeScript, Rust, and Julia. This breadth allows systems engineers targeting high-performance environments (Rust) and full-stack developers (TypeScript) to master AI engineering within their native ecosystems rather than being confined solely to Python.
- Open and Frictionless Access: The material is fully accessible without paywalls or account creation on both the official interactive site (aiengineeringfromscratch.com) and the GitHub markdown repository, supported by over a dozen community-led translation efforts.
Navigating 342 Hours of Content: Goal-Based Routes and Practical Adoption
Given the sheer scale of 342 hours of coursework, adopting a targeted approach is vital for working professionals.
- Leverage Goal-Based Routes: Attempting to tackle all 523 lessons sequentially from beginning to end can easily lead to burnout or bookmark fatigue. Working developers with existing programming or mathematical foundations are encouraged to bypass early stages and jump directly to Phase 11 (LLM Engineering), Phase 13 (Tools & Protocols), or Phase 14 (Agent Engineering) based on immediate project demands.
- Backward-Induction Engineering Strategy: A highly effective practice is to spin up an agent or MCP project first, and then trace backward into earlier tokenizer or foundational math lessons only when running into optimization bottlenecks, latency constraints, or token budget boundaries.
- Note on Multi-Language Maturity and Rapid Framework Evolution: While four languages are supported, documentation depth and example completeness may differ across implementations. Additionally, because agent frameworks and external provider APIs evolve rapidly, developers should always cross-reference dependency versions and compatibility against current production environments.
Sources
- GitHub Repository: rohitg00/ai-engineering-from-scratch
- Official Website: AI Engineering from Scratch
- Discussion on X: @RoundtableSpace Post