Library / Artificial Intelligence

Build an AI Agent From Scratch in Python (No LangChain)

On Udemy

About this course

This course contains the use of artificial intelligence.

An AI agent is just an LLM in a loop that chooses its own next action. Once you can write that loop — about twenty lines of plain Python — every "agent framework" on the market stops being magic.

This course is the un-magic. You build your own agent framework from scratch, one concept at a time, and walk away understanding every line of it — and able to read LangChain, CrewAI, or AutoGen like an open book.

What you'll build, across nine short modules: the reusable agent loop with a correct stopping condition; tool use from scratch (parse, a registry and dispatch, and graceful handling when the model invents a tool); three kinds of memory — working, episodic, and semantic retrieval you build with your own cosine similarity in numpy; planning with ReAct, reflection-and-retry, and a real beam-search tree-of-thoughts; multi-agent systems with a coordinator and a delegation cap so it can never loop forever; evaluation — the part almost no course teaches — a harness, the three metrics that matter, a failure taxonomy, and regression diffs; production hardening with cost and step caps, structured logging, and tool guardrails; and a capstone that consolidates it into one clean API and builds a flagship agent end to end.

Honest about scope: "from scratch" means you build everything that turns a model into an agent. The one black box we keep is the language model and its embeddings, called through a thin wrapper. It's about 1,300 lines of pure Python — numpy and a provider client only. No LangChain, no vector database.

You need solid Python and to have called an LLM API once. You do not need any machine-learning math — the one bit, a dot product, is taught from scratch. By the end you won't just have working code; you'll have the judgment to design agents that don't burn money or fail silently, and you'll understand what every framework on the market is really doing.

Ready to start? Continue on Udemy to enroll.

Start learning on Udemy (opens in a new tab)

Prices, discounts and availability are set by Udemy. We may earn a commission when you purchase through links on this site.