# ai-agents-from-scratch

> ai-agents-from-scratch is an open-source AI tool for ai models and llm tooling. Step-by-step tutorial for building AI agents locally in JavaScript with node-llama-cpp. It is available on self-hosted.

- **Kind:** Tool
- **Pricing:** Open source
- **Platforms:** self-hosted
- **Repository:** https://github.com/pguso/ai-agents-from-scratch
- **GitHub stars:** 4,918
- **License:** MIT
- **Categories:** AI models and LLM tooling
- **Listing updated:** 2026-11-14

## About

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.

## Features

- **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

## 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

- [ECC](https://ai-powered.com/tools/ecc): ECC is a freemium AI tool for ai models and llm tooling.
- [ponytail](https://ai-powered.com/tools/ponytail): ponytail is an open-source AI tool for ai models and llm tooling.
- [graphify](https://ai-powered.com/tools/graphify-2): graphify is a freemium AI tool for knowledge and memory.
- [ragflow](https://ai-powered.com/tools/ragflow): ragflow is a freemium AI tool for knowledge and memory.
- [Agent-Reach](https://ai-powered.com/tools/agent-reach): Agent-Reach is an open-source AI tool for ai models and llm tooling.
- [OmniRoute](https://ai-powered.com/tools/omniroute): OmniRoute is a freemium AI tool for ai models and llm tooling.
- [ai-engineering-from-scratch](https://ai-powered.com/tools/ai-engineering-from-scratch): ai-engineering-from-scratch is an open-source AI tool for ai models and llm tooling.
- [crawl4ai](https://ai-powered.com/tools/crawl4ai): crawl4ai is a freemium AI tool for web search and scraping.

---
Source: https://ai-powered.com/tools/ai-agents-from-scratch
