
ai-agents-from-scratch
Step-by-step tutorial for building AI agents locally in JavaScript with node-llama-cpp
- Pricing
- Open source
- Platforms
- self-hosted
- GitHub stars
- 4.9K
- Last commit
- 4 months ago
- Language
- JavaScript
- License
- MIT
About ai-agents-from-scratch
ai-agents-from-scratch is an open-source AI tool for ai models and llm tooling. It is available on self-hosted.
Instead of reaching for a framework, the course walks through each layer by hand: loading a local model, the prompt and response cycle, tool use, and finally a ReAct-style agent. Each lesson has runnable code plus separate code explanations and concept notes.
Examples run with Node.js 18 or newer and local models placed in a models folder; the README suggests at least 8 GB of RAM and 16 GB if possible. An optional lesson shows how to call a hosted model, and a Python version lives in a sibling repository. A companion website explains the learning path visually.
What it does
- Local-model examples
- Lessons use node-llama-cpp so no hosted API is needed.
- Progressive learning path
- Starts with a basic LLM call and builds to a ReAct agent.
- Code and concept notes
- Each example links to a code walkthrough and a concepts page.
- Optional hosted lesson
- One lesson covers calling a hosted model, temperature and token usage.
- Companion website
- A site maps the learning path and explains each example.
Good for
- Learn how agents work before adopting a framework
- Run an LLM on your own machine from Node.js
- Study ReAct agent structure with working code
- Teach agent fundamentals in a workshop
Pricing
Open source
MIT licensed tutorial
ai-agents-from-scratch FAQ
What do I need to run it?
Node.js 18 or newer and at least 8 GB of RAM, with model files downloaded into the models folder.
Is there a Python version?
Yes, the README links to a separate Python tutorial repository.
What is the licence?
MIT.
Is ai-agents-from-scratch free?
Yes. ai-agents-from-scratch is open source, so you can use and self-host it for free.
What are the best alternatives to ai-agents-from-scratch?
The closest alternatives to ai-agents-from-scratch are ECC, ponytail, graphify, ragflow and Agent-Reach.
Alternatives to ai-agents-from-scratch

Skills, hooks, memory and security layer for coding agent harnesses
- Freemium
- Open-source agent
- 305K GitHub stars
- AI models and LLM tooling

Ruleset that makes AI coding agents write less code that still works
- Open source
- Open-source agent
- 192K GitHub stars
- AI models and LLM tooling

Code knowledge graph that gives coding assistants shared, source-linked context
- Freemium
- Open-source agent
- 149K GitHub stars
- Knowledge and memory

Open-source RAG engine with a document pipeline, hybrid search and visual agent workflows
- Freemium
- Open-source agent
- 94.3K GitHub stars
- Knowledge and memory

Command-line channels that let AI agents read X, Reddit, YouTube and Chinese platforms
- Open source
- Open-source agent
- 112K GitHub stars
- AI models and LLM tooling

Self-hosted AI gateway routing many providers through one local endpoint with fallback
- Freemium
- Open-source agent
- 88.1K GitHub stars
- AI models and LLM tooling