What Programming Languages Are Used in the AI Engineering from Scratch Repository?
The AI Engineering from Scratch repository uses Python, TypeScript, Rust, and Julia as its four core programming languages, following a strict "stdlib-first" policy defined in AGENTS.md that limits dependencies and enforces pedagogical clarity.
The rohitg00/ai-engineering-from-scratch curriculum teaches AI engineering concepts from first principles across multiple implementation phases. While the educational content remains deliberately language-agnostic, the codebase adheres to a strict standard library-first approach that restricts each lesson to one of four carefully selected languages, ensuring learners understand foundational mechanics without framework abstraction obscuring core concepts.
Core Programming Languages in the Curriculum
According to the repository's AGENTS.md file, the codebase explicitly restricts implementations to four supported languages. Each serves a distinct pedagogical purpose within the structured learning path.
Python: The Primary Teaching Language
Python serves as the dominant instruction language throughout the repository, appearing in the majority of lesson implementations. The phases/*/code/ directories contain numerous main.py files that demonstrate everything from basic agent architectures to production LLM applications.
Python handles the core teaching load because it provides readable syntax while maintaining sufficient performance for educational examples. The repository enforces strict stdlib-only Python code, prohibiting external dependencies that might hide implementation details from learners.
TypeScript: Web Tooling and Site Generation
TypeScript powers the repository's web infrastructure and build tooling. The site/build.js file (compiled from TypeScript source) generates the static site that renders the curriculum materials.
This language choice ensures that web-facing components remain type-safe while leveraging the vast JavaScript ecosystem for documentation generation. TypeScript implementations appear exclusively in tooling contexts rather than lesson implementations.
Rust: Systems-Level Examples
Rust appears in select lessons requiring memory safety or systems-level performance characteristics. The repository restricts Rust code to single-file examples compiled with rustc --edition 2021, avoiding complex Cargo workspaces that might distract from the AI engineering concepts being taught.
These implementations typically appear in phases discussing performance optimization or low-level agent primitives, where Rust's ownership model provides explicit pedagogical value.
Julia: Mathematical Computing
Julia handles math-heavy lessons that rely on numerical computing and statistical operations. Implementations utilize the Julia standard library exclusively, specifically modules like Random and Statistics, to demonstrate algorithms without external ML frameworks.
This language excels in lessons covering optimization algorithms, statistical methods, and mathematical foundations of machine learning where Python's dynamic typing might obscure numerical precision concepts.
File Structure and Implementation Details
The repository enforces its language policy through specific file naming conventions and directory structures. Each lesson resides in a numbered phase directory with a predictable layout.
Key files demonstrating the multi-language architecture include:
AGENTS.md— Defines the allowed languages and the philosophical "stdlib-first" constraint that prohibits external dependenciesphases/19-capstone-projects/87-end-to-end-safety-gate/code/main.py— Illustrates a complete Python-based lesson entry point implementing safety gate patternsphases/08-multi-agent-and-swarms/04-primitive-model/code/main.py— Shows Python implementations of basic agent swarm architecturesphases/11-llm-engineering/13-production-app/code/production_app.py— Demonstrates production-grade LLM application patterns built from scratchsite/build.js— The TypeScript-generated JavaScript responsible for static site generation
Practical Code Examples
The following snippets illustrate the coding style enforced throughout the curriculum for each supported language. These examples reflect the actual patterns found in lesson implementations.
Python Entry Point
Typical of the phases/*/code/main.py files found throughout the repository:
# main.py – a simple entry point for a lesson
def main():
print("Hello, AI Engineering from Scratch!")
if __name__ == "__main__":
main()
TypeScript Build Utility
Representative of the site-generation tooling:
// build.ts – a tiny TypeScript utility used by the site generator
function greet(): void {
console.log("Building the AI Engineering curriculum site...");
}
greet();
Rust Single-File Example
A minimal binary adhering to the rustc --edition 2021 constraint:
// main.rs – a tiny Rust program (std-only)
fn main() {
println!("Hello from Rust in AI Engineering!");
}
Julia Mathematical Script
Typical of numeric computing lessons utilizing the Julia standard library:
# hello.jl – a basic Julia script
println("Hello, Julia from AI Engineering!")
Summary
The AI Engineering from Scratch repository employs a deliberate four-language strategy to teach AI concepts without framework dependency bloat:
- Python provides the primary instructional language for AI and agent implementations across all phases
- TypeScript handles documentation generation and web tooling through the
site/build.jsgenerator - Rust offers systems-level examples compiled with edition 2021 for performance-critical lessons
- Julia enables mathematical and statistical computing using only standard library modules
- The
AGENTS.mdfile enforces a strict "stdlib-first" policy preventing external dependencies in lesson code - Every lesson implementation follows the language specified in its documentation front-matter
Frequently Asked Questions
Is Python the only language used in AI Engineering from Scratch?
No. While Python serves as the primary teaching language for most lessons in the phases/*/code/ directories, the repository explicitly supports TypeScript, Rust, and Julia according to AGENTS.md. TypeScript appears in build tooling like site/build.js, while Rust and Julia appear in specific lessons addressing systems programming and mathematical computing respectively.
Why does the repository use multiple programming languages instead of just Python?
The curriculum adopts a polyglot approach to match each lesson's pedagogical requirements with the most illustrative language. Python handles general AI engineering, Julia excels at mathematical foundations, Rust demonstrates memory-safe systems concepts, and TypeScript manages the documentation infrastructure. This diversity ensures learners understand language-agnostic principles rather than framework-specific implementations.
What is the "stdlib-first" policy mentioned in AGENTS.md?
The "stdlib-first" policy restricts all lesson code to standard library imports only, prohibiting external dependencies like NumPy, PyTorch, or external crates. This constraint forces implementations in phases/*/code/main.py and other lesson files to demonstrate algorithms from scratch, ensuring learners comprehend the underlying mechanics rather than calling abstracted library functions.
Which programming language is best for production LLM apps according to this curriculum?
The repository demonstrates production LLM applications primarily in Python, as evidenced by phases/11-llm-engineering/13-production-app/code/production_app.py. While Python remains the practical choice for production AI engineering in the curriculum, the underlying concepts taught are language-agnostic, and the stdlib-first approach ensures the patterns translate to any production environment.
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 →