Udemy
Turn what you know into an opportunity and reach millions around the world.
Learn More
Your cart is empty.
Keep shopping
AI Agents From Scratch in Python: The Agentic AI Harness
New

AI Agents From Scratch in Python: The Agentic AI Harness

Agentic AI in plain Python: the agent loop, tools, permissions, memory, plans, guardrails and evals on a local model
Created byAdi Tejus
Last updated 11/2026
English

What you'll learn

  • Explain what an agent harness is and build the agent loop in plain Python around a local model with tool calling
  • Turn Python functions into checked tools with permissions (allow, ask, deny) and a sandboxed folder
  • Manage context: token budgets, shrinking tool output, summaries and a notes file for long-term memory
  • Add plans, to-do lists, result verification and helper sub-agents for multi-step office tasks
  • Defend against prompt injection, secret leaks and invented numbers, and score every version with an eval suite
  • Rebuild the same agent with an official agent SDK and judge what a framework does and doesn't do for you

Course content

8 sections • 8 lectures • 1h 56m total length
  • Build your own AI agent from scratch: the finished harness, running5:31

    Overview. Build your own AI agent from scratch: the finished harness, running. The finished project running first, then the plan for the course, what you need, and the course code (attached here as a download).

Requirements

  • Basic Python: functions, dictionaries, loops
  • A computer with Python 3.10+, about 1 GB no-cost disk for Ollama and one small model (8 GB RAM is enough)
  • No API keys or paid accounts

Description

This course contains the use of artificial intelligence.

Every AI agent is a model inside a harness: the code that gives it tools, checks what it may do, decides what it sees and when it stops. In this course you write that harness yourself, in plain Python with no framework, around a local model (qwen2.5:0.5b through Ollama, about 400 MB). No API key, no card, and every file stays on your computer.

Every section ends with something you build and run on a small office folder (an expense sheet, meeting notes, a vendor log and a supplier email): the agent loop in about 50 lines; tools built from Python functions with checked arguments, approvals and a folder the agent cannot leave; context budgets, summaries and a notes file, with a measured demo of an agent forgetting; plans, to-do lists, verification and helper agents; guardrails against prompt injection, secrets and invented numbers; an eval suite of 10 tasks run 3 times per version; and the same agent rebuilt with the OpenAI Agents SDK (openai-agents 0.24.0) on the same local model.

The model is tiny on purpose. You see its real mistakes, a harness bug that overwrote the data and how it was made impossible, and an honest final scoreboard where the simplest well-tooled agent beat the version with the most features. Every output shown is from a real run on 31 October 2026; the code, logs, tests, practicals and cheat sheets are included. Narration is AI-voiced; the code, runs and results are real.

The course is 2 h 16 min of video in 8 sections. Section 1 is the overview and setup; the other sections are hands-on, and every program is run for real on screen. Each hands-on section comes with a one-page cheat sheet (PDF), a short quiz, a practical with starter and solution files and an assignment with a model answer; 5 coding exercises let you write the code yourself.

Who this course is for:

  • Python beginners who use AI agents and want to know how they work inside
  • Developers and analysts asked to build a safe internal assistant that works on files
  • Students who want a portfolio project with measured results, not just a demo