AI Agents from Scratch

Build one agent step by step from a single local LLM call — no frameworks, no cloud APIs, no hidden reasoning.

Stars
★ 1.1k
Last updated
4mo ago
FARS reviewed
Nov 08, 2026
License
MIT
Primary language
Python

At a glance

How it runs
CLILibrary / SDK
Works with
Universal · cross-platform
Cost
Free, no paid service needed
Setup effort
Medium · a few setup steps
You'll need
PythonpipGGUF model fileShell / CLILocal filesystem
Typical use
Backend developers who can code but are lost on how agent loops, state and tools actually fit together
Not a fit if
  • Teams wanting a ready-made demo or SaaS starter kit
  • Users unwilling to download a GGUF model into a local models/ folder
  • Projects needing production-grade, hosted best practices
Maintenance
Commits in the last 6 monthslast commit 2026-07-25

What does this agent do, and when should you use it?

agents-from-scratch is a local-first educational repository that grows a single agent across 12 lessons, starting from one local LLM call and ending with memory, planning, evals and telemetry. The implementation lives in the Agent class in agent/agent.py, which gains new methods in each chapter; supporting modules include memory.py, planner.py, state.py, tools.py, evals.py and telemetry.py, with shared LLM and prompt utilities under shared/. Execution is plain Python against a local GGUF model — no OpenAI or cloud API, no API keys — and complete_example.py runs each of the 12 lessons as a standalone function. evals/golden_datasets.py holds known-good cases for regression testing. The project is explicitly framed as teaching material rather than a production framework.

The curriculum evolves one agent in order: 01 text in / text out; 02 roles via system prompts; 03 structured output enforced by JSON contracts; 04 routing-based decision making; 05 tools from tools.py; 06 the observe → decide → act agent loop; 07 short- and long-term memory through memory.py; 08 planning stored as data rather than thoughts (planner.py); 09 safe execution of atomic actions; 10 Atom of Thought dependency graphs; 11 regression testing with agent/evals.py against evals/golden_datasets.py; 12 runtime observability via agent/telemetry.py, emitting structured logs, latency and traces. Running python complete_example.py isolates each lesson; LLM traffic goes through the shared layer to a local GGUF model. Outputs are text, structured JSON, tool results, and evaluation/telemetry records.

  1. Backend developers who can code but are lost on how agent loops, state and tools actually fit together
  2. Educators and trainers who need an offline-capable walkthrough of agent architecture for a classroom or workshop
  3. Engineers experimenting with local GGUF models on prompts and structured JSON output
  4. Learners who want a concrete model for adding evals and telemetry to an existing Python project
  5. Curriculum designers building a staged course around agent fundamentals

Key setup facts

Pulled from the install and usage notes below. The project README has the current values.

Install / run
  • pip install -r requirements.txt

How do you install or deploy this agent?

The README's quick start is three steps: install dependencies, download a GGUF model into models/, and run the example.

pip install -r requirements.txt

Then place a GGUF model file into the repository's models/ directory. The README does not name a specific model or download source — that piece must be supplied by you. A detailed setup guide is provided in QUICKSTART.md.

How do you use this agent?

Run the bundled example to see all 12 lessons demonstrated. Proceed in order through the lessons; the README explicitly advises against skipping ahead.

python complete_example.py

To study the evolving implementation, start with the Agent class in agent/agent.py and read lessons/01_basic_llm_chat.md through lessons/12_telemetry.md. For regression testing, compare agent behavior against the known-good cases in evals/golden_datasets.py using agent/evals.py.

Safety boundaries, hardening & integrations

Operational blast radius, source-verified safety controls, and first-run hardening steps before connecting this agent to real workspaces.

Declared capability surface (blast radius)

Local shell command execution

Can run terminal commands; pair with approval gates or container/OS sandboxing.

Local filesystem read/write

Modifies local files; work on a clean Git branch or dedicated worktree.

FARS trust-control audit

Not found in source — apply before daily use
  • confirmation before acting — Turn on (or add) a confirmation step before it acts, and try it in a sandbox or test environment before real data.
  • sensitive-data handling — Use dedicated, low-privilege, revocable API keys — never production credentials — and keep secrets out of logs.
  • rollback or recovery path — Back up first, or work on a git branch or snapshot, so its changes can be undone.

What are this agent's strengths and limitations?

Pros
  • A single agent/agent.py evolves across all 12 lessons, so each capability's addition is traceable to one file
  • Fully local: no OpenAI or cloud API, no API keys, no rate limits
  • Relies on JSON contracts and explicit constraints instead of prompt cleverness, per the stated 'structure over prompting' principle
  • Ships both a regression eval harness (agent/evals.py + golden datasets) and a telemetry module
  • MIT licensed, with complete_example.py giving a runnable demo per lesson
Limitations
  • Self-described as educational, not production — it does not teach deployment or best practices
  • You must source a GGUF model yourself; the README names no model or download URL
  • No packaging: usage means cloning the repo and running Python scripts
  • No cloud or hosted-model path; switching to a remote API means rewriting the shared LLM layer
  • Python only — the JavaScript variant lives in a separate repository

How does this agent compare with similar options?

The README explicitly positions the project against 'just use LangChain' and excludes frameworks by design: where LangChain abstracts models, tools and control flow, this repository keeps them as explicit Python to make the loop, state and constraints visible, trading production scaffolding for transparency.

Key facts side by side with the most closely related agents.

Agent Source review Form / cost Stars Updated Language Full support on
AI Agents from Scratch This agent 47 · Major gaps CLIFree ★ 1.1k 4mo ago Python —
AI Agents From Scratch 55 · Major gaps CLIFree ★ 4.9k 4mo ago JavaScript —
Agent Design Patterns (ADPS) 72 · Some gaps Library / SDKFree ★ 363 16d ago HTML —
Build AI Agents from First Principles 58 · Major gaps FrameworkFree + model costs ★ 402 29d ago Python OpenAI API · Claude API

How does FollowAgents rate this agent?

FollowAgents source review · FARS-2.1
Major gaps
47/ 100 5-point scale 2.4 / 5
Trust 7/29
Reliability 5/14
Adaptability 12/18
Convention 10/18
Effectiveness 9/13
Verifiability 4/8
Why each dimension lost points
Trust7 / 29 · 1.2/5

The code shows a local GGUF model, one llama-cpp-python dependency, and explicit tool calls, making the described data flow reasonably clear (2). The dependency has no version or security details. The supplied material does not adequately establish tool permissions, sensitive-data handling, confirmation, rollback, or maintainer identity, so those criteria score only 0–1.

Reliability5 / 14 · 1.8/5

Structured output and decisions retry up to three times and return None on failure, showing a limited recovery path. README and code comments disagree on the lesson count (12 versus 10), the dependency is unpinned, and failure reporting is thin, so these criteria score 1.

Adaptability12 / 18 · 3.3/5

The README identifies learners, educators, and engineers, and states who the project is not for, supporting strong audience and scenario coverage. The supplied code excerpt shows some capabilities, but trigger conditions, full capability boundaries, and environment compatibility are only partly described.

Convention10 / 18 · 2.8/5

The README provides a lesson index, repository structure, and key-file explanations; it points to a separate QUICKSTART, and the MIT license text is complete. The lesson-count mismatch, lack of a visible version or changelog, and absence of a named maintainer or clear update path justify deductions.

Effectiveness9 / 13 · 3.5/5

The progressive lessons, examples, and readable single-agent code have direct educational use. The materials position the project as educational rather than production guidance, but provide no measured time or resource costs, so utility and cost-benefit score moderately.

Verifiability4 / 8 · 2.5/5

README claims about lessons and key files are partly traceable to the listed paths and supplied agent/agent.py excerpt; the license is independently represented. The sample cannot corroborate the full implementation, and static materials cannot verify runtime outcomes. The project distinguishes its educational purpose from production use, supporting a score of 2 for separating fact from inference.

Risks and how to mitigate them
  • Not found in source: confirmation before actingTurn on (or add) a confirmation step before it acts, and try it in a sandbox or test environment before real data.
  • Not found in source: sensitive-data handlingUse dedicated, low-privilege, revocable API keys — never production credentials — and keep secrets out of logs.
  • Not found in source: rollback or recovery pathBack up first, or work on a git branch or snapshot, so its changes can be undone.
  • The README claims 12 lessons while agent/agent.py comments list 10; the supplied sample is incomplete and cannot establish all tool, data-handling, or runtime behavior.
  • The dependency is unpinned; README statements about safety or observability should not be treated as verified runtime guarantees.
Evidence confidence: Low Reviewed Nov 08, 2026 Reviewed revision da3f9df28a9c
See the full review method →
Maintain this project? Add the FARS badge to your README

The badge shows the current review score and verdict and links back to this page. It refreshes about once an hour after a re-review.

FARS

[![FARS review](https://followagents.com/badge/pguso-agents-from-scratch.svg)](https://followagents.com/en/agents/pguso-agents-from-scratch)
<a href="https://followagents.com/en/agents/pguso-agents-from-scratch"><img src="https://followagents.com/badge/pguso-agents-from-scratch.svg" alt="FARS review"></a>

FAQ

Does running it cost anything or require API keys?
No. It runs entirely locally against a GGUF model and never calls OpenAI or other cloud APIs, so there are no per-call charges and no API key needed.
Which model and hardware do I need?
You supply a GGUF model file in models/ and install the Python dependencies from requirements.txt. The README does not specify a model name, size, or VRAM requirement, so that choice is yours.
Can I use it in production?
The README states outright that this is educational material teaching fundamentals, not production best practices; the code optimizes for readability over robustness and deployment.
What do the evals and telemetry lessons actually provide?
Lesson 11 pairs agent/evals.py with golden datasets in evals/golden_datasets.py for prompt regression testing; lesson 12 adds agent/telemetry.py for structured logging of latency, success rates and traces.
Is there a JavaScript version?
Yes. The README points to the author's ai-agents-from-scratch repository for a JavaScript counterpart; this repository is the Python implementation.
Was this page helpful?
View on GitHub ↗ Install ↓

Compare agents like this one

The same FARS review applied across the shortlist this agent qualifies for.

Related concepts