ai-agents-from-scratch
Demystify AI agents by building them yourself. Local LLMs, no black boxes, real understanding of function calling, memory, and ReAct patterns.
What it does
Core capabilities at a glance
- AI Agents
- Educational
- Function Calling
- LLM Agent
- Node Llama CPP
- React Agent
- Tutorial
Deep dive
The full breakdown - performance, comparisons, and setup
ai-agents-from-scratch
ai-agents-from-scratch is an agent framework - Demystify AI agents by building them yourself. Local LLMs, no black boxes, real understanding of function calling, memory, and ReAct patterns.
Overview
Learn to build AI agents locally without frameworks. Understand what happens under the hood before using production frameworks.
This repository teaches you to build AI agents from first principles using local LLMs and node-llama-cpp. By working through these examples, you'll understand:
Philosophy: Learn by building. Understand deeply, then use frameworks wisely.
- Node.js 18+ - At least 8GB RAM (16GB recommended) - Download models and place in './models/' folder, details in DOWNLOAD.md
Decision guide: use ToT when you need to search competing paths; use GoT when you need to combine multiple sources into one consistent policy. Compare both in: - ToT concept - GoT concept
What you'll learn: - Precomputing embeddings for short exemplar phrases per tool - Scoring the user message against exemplars (cosine similarity) with a small embedding model - Passing only top-k tools (plus optional always-include tools) into 'session.prompt' - Observing recall failure when k is too small for multi-intent prompts
- ' .js' - The working code example - 'CODE.md' - Step-by-step code explanation - Line-by-line breakdowns - What each part does - How it works - 'CONCEPT.md' - High-level concepts - Why it matters for agents - Architectural patterns - Real-world applications - Simple diagrams
ai-agents-from-scratch is open-source, written primarily in JavaScript, with 4,240 GitHub stars under the MIT license. It was last updated on 2026-05-31.
Key capabilities
From the project's documentation:
- How LLMs work at a fundamental level
- What agents really are (LLM + tools + patterns)
- How different agent architectures function
- Why frameworks make certain design choices
- Explains why each example exists
- Visualizes the learning path from raw LLM calls to full agents
How it fits a local-AI stack
ai-agents-from-scratch runs on your own hardware, so pair it with a model and a GPU sized to your needs. Use the VRAM calculator to pick a model that fits your card, and see what you can run for hardware guidance. Related agent frameworks in the directory:
Sources
- Source code & docs: pguso/ai-agents-from-scratch
Stats from GitHub, 2026-06-08.
Frequently asked
Quick answers to common questions
What is ai-agents-from-scratch?
ai-agents-from-scratch is a agent-framework tool for local AI workloads. Demystify AI agents by building them yourself. Local LLMs, no black boxes, real understanding of function calling, memory, and ReAct patterns.
Is ai-agents-from-scratch free and open source?
Yes, ai-agents-from-scratch has 4,240 GitHub stars and is licensed under MIT. You can self-host it for free on .
What hardware do I need for ai-agents-from-scratch?
The hardware requirements depend on which models you run. Check our hardware directory for compatible GPUs and systems. ai-agents-from-scratch has 4,240 GitHub stars and an active community.
Does ai-agents-from-scratch support GPU acceleration?
ai-agents-from-scratch's GPU support depends on your specific setup. Check the documentation for details. For the best performance, pair it with an NVIDIA RTX 4090 or 5090.
What are the best alternatives to ai-agents-from-scratch?
Popular alternatives include other agent-framework tools in our directory. Browse our full collection at /tool for comparisons, community reviews, and benchmark data to find the right fit for your workflow.
How much does ai-agents-from-scratch cost?
ai-agents-from-scratch is free-open-source. It is completely free and open source to self-host.
Pairs well with
Complementary tools, models, and hardware
Comments coming soon
Configure NEXT_PUBLIC_GISCUS_REPO_ID and NEXT_PUBLIC_GISCUS_CATEGORY_ID at giscus.app to enable.