Programming Languages Supported in the 'code/' Directory of AI Engineering Lessons
The 'code/' directories in the rohitg00/ai-engineering-from-scratch repository support exactly four programming languages: Python, TypeScript, Rust, and Julia.
Every lesson in this open-source curriculum stores its implementation inside a code/ folder following a strict directory convention. Understanding which programming languages are supported in the 'code/' directory of lessons helps learners know what runtimes to install and how to navigate the repository's hands-on examples.
The Four Officially Supported Languages
According to the repository's AGENTS.md file, the curriculum restricts lesson implementations to four specific runtimes. A comprehensive scan of all code/ directories confirms that every lesson adheres to this constraint.
Python (.py)
Python serves as the primary teaching language for mathematical foundations and machine learning workflows. You will find Python implementations in paths like phases/01-math-foundations/01-linear-algebra-intuition/code/main.py and phases/05-nlp-foundations-to-advanced/05-sentiment-analysis/code/main.py.
Typical Python lessons expose concise functions for model training:
# main.py (Python)
import numpy as np
def simple_linear(x):
w = np.random.randn()
b = np.random.randn()
return w * x + b
TypeScript (.ts)
TypeScript handles asynchronous operations and agent engineering patterns. Look for .ts files in locations such as phases/14-agent-engineering/01-the-agent-loop/code/main.ts and phases/11-llm-engineering/01-prompt-engineering/code/main.ts.
Entry points often demonstrate async/await patterns:
// main.ts (TypeScript)
export async function fetchJson(url: string) {
const response = await fetch(url);
return await response.json();
}
Rust (.rs)
Rust appears in performance-critical lessons, particularly within the LLM internals and optimization phases. Key examples include phases/10-llms-from-scratch/01-tokenizers/code/bpe.rs and phases/10-llms-from-scratch/12-inference-optimization/code/main.rs.
Rust implementations focus on zero-cost abstractions:
// bpe.rs (Rust)
pub fn tokenize(text: &str) -> Vec<String> {
text.split_whitespace().map(|s| s.to_string()).collect()
}
Julia (.jl)
Julia supports deep learning core concepts and numerical computing lessons. Representative files include phases/03-deep-learning-core/03-backpropagation/code/main.jl and phases/03-deep-learning-core/04-activation-functions/code/main.jl.
Julia code leverages its mathematical syntax:
# main.jl (Julia)
multiply(A, B) = A * B
Repository Structure and Language Enforcement
Lessons follow a strict path convention: phases/<phase-slug>/<lesson-slug>/code/. The AGENTS.md configuration explicitly lists the four allowed languages, preventing contributors from adding lessons in unsupported runtimes.
While Bash scripts (.sh) appear throughout the repository, they function strictly as tooling wrappers for CI pipelines and environment setup. The curriculum does not treat shell scripts as lesson implementation languages.
Architectural Rationale for Language Selection
The maintainers chose this specific quad-lingual approach for three strategic reasons:
- Uniformity – Limiting lessons to four languages keeps the curriculum focused on algorithmic concepts rather than language-specific boilerplate.
- Cross-language comparison – Having identical algorithms expressed in Python, TypeScript, Rust, and Julia allows learners to compare performance characteristics and ergonomics side-by-side.
- Tooling simplicity – Continuous integration only requires four runtimes (
python,node,rustc,julia), maintaining a lean build environment.
Running the Code
Each lesson's code/ directory contains self-contained modules executable via standard commands:
# Python
python main.py
# TypeScript
npx ts-node main.ts
# Rust
cargo run
# Julia
julia main.jl
Every implementation pairs with a test suite located in the sibling tests/ folder, ensuring learners can verify their understanding regardless of which language they choose to study.
Summary
- The 'code/' directory supports exactly four languages: Python, TypeScript, Rust, and Julia.
- Lesson implementations live at
phases/<phase-slug>/<lesson-slug>/code/with consistent file extensions. - AGENTS.md enforces this language restriction, excluding bash scripts from lesson code.
- Each language targets specific pedagogical goals: Python for ML foundations, TypeScript for async/agent patterns, Rust for performance optimization, and Julia for numerical computing.
- All lessons include runnable entry points and corresponding test suites in adjacent
tests/directories.
Frequently Asked Questions
Does the repository support languages other than Python, TypeScript, Rust, and Julia?
No. The AGENTS.md file explicitly restricts lesson implementations to these four languages. While Bash scripts appear for tooling automation, they do not count as supported lesson languages.
Where are the lesson code files located?
All lesson implementations reside under phases/<phase-slug>/<lesson-slug>/code/. For example, linear algebra intuition code exists at phases/01-math-foundations/01-linear-algebra-intuition/code/main.py.
Can I run the code examples directly?
Yes. Each language supports direct execution: use python main.py for Python, npx ts-node main.ts for TypeScript, cargo run for Rust, or julia main.jl for Julia modules.
Are there tests for the code in each lesson?
Yes. Every code/ directory has a sibling tests/ folder containing validation suites. This structure ensures learners can verify implementations across all four supported languages.
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 →