AI Agents From Scratch is an educational tutorial that teaches you to build AI agents locally from first principles using local LLMs and node-llama-cpp.
The project addresses the challenge of understanding how AI agents actually work by having you build them yourself rather than treating frameworks as black boxes. It demonstrates that agents are fundamentally LLMs combined with tools and patterns, and walks through progressively complex examples starting from basic LLM interaction, moving through system prompts and specialization, and advancing to reasoning and problem-solving patterns. By implementing each layer yourself, you gain concrete understanding of function calling, memory management, and ReAct patterns before relying on production frameworks.
This tool suits developers who want to understand agent architecture deeply before adopting a framework, or who prefer to build agents with local models for privacy and control. The learning path is structured to build progressively, starting with loading and running a local LLM, then covering system prompts for agent specialization, and reasoning patterns. The project includes both code examples and conceptual explanations, with a companion website that provides mental models and visualizations of the learning progression. The repository is designed for Node.js environments with at least 8GB of RAM, and requires downloading models locally.
The project maintains parallel implementations across languages to serve different developer communities. Development activity shows consistent engagement with the codebase through refinement of examples and explanations. The project provides structured learning materials including code explanations and concept documents alongside working examples, indicating a focus on pedagogical clarity alongside functional code.