5 episodes, about 45 min 2 views across the series

Topics: Agents Code: readytensor/building-ai-agents-code

Building AI Agents

Created by Abhyuday DesaiUpdated , episode 5

Build a coding agent from scratch in plain Python, one capability per episode: the loop, tools, skills, subagents and verification, then test it on a public benchmark.

Start with episode 1

About this series

A coding agent built from first principles, in plain Python with no frameworks: short videos with animated diagrams and code scenes, and a public companion repo with the complete agent as it stands after every episode. The series is for developers who are comfortable with Python and with calling a model API. No experience building agents is needed.

One idea runs through every episode. An agent is a loop: a task goes to a language model, and when the model asks for a tool, our code runs it, adds the result to the conversation and sends the conversation back. When the model replies without asking for a tool, that reply is the answer. Every episode adds one capability to that loop, in code, and shows what the agent can do with it that it could not do before.

The agent works on one codebase throughout: md2html, a small command-line tool that turns Markdown into HTML in three stages (tokens, a document tree, HTML), each with its own tests. The agent's tasks are real features in it, and the tests say whether the work is right.

Three parts.

Getting started

  • 1. Series Overview. What an agent does, where the same loop is used, and what the series builds.
  • 2. Project Setup. The project, the repository, and how to run the code yourself.

Building the agent

  • 3. The Loop. A while loop, a model, and one tool that runs shell commands.
  • 4. Tools. Proper tools for working with files, and a short way to define new ones.
  • 5. Skills. Instructions and tools the agent loads only when a task needs them.
  • 6. Subagents. Handing part of a task to a separate worker, with several workers running at once.
  • 7. Verification. Checks the work must pass before the agent may stop, instead of trusting the model's word.

The benchmark

  • The finished agent on code it has never seen: real issues from well-known Python projects, scored by their tests. Two or three videos: setting up the benchmark, then the results.

By the end you can write a working agent from an empty file, add to it deliberately, find out why a run went wrong from the record it keeps, and recognize the same loop inside any agent framework or product.

Part oneGetting started

  1. 01

    Series Overview

    What an AI agent is, the loop every agent runs, and the plan for building a coding agent from scratch in plain Python.

    3:50 0 views Updated , v3
    Watch
  2. 02

    Project Setup

    Get the companion code running: the packages, the model configuration, how the repository is organized, and two ways to run an episode.

    5:05 0 views Updated , v3
    Watch

Part twoBuilding the agent

  1. 03

    The Loop

    The agent loop in plain Python with one bash tool: agent.py part by part, then a real run that adds a table of contents to md2html.

    12:39 1 view Updated , v4
    Watch
  2. 04

    Tools

    Giving an agent tools: what the model is told about each one, a decorator that generates that from a plain Python function, the guards a tool needs, and a run where the agent reaches the web.

    12:51 1 view Updated , v2
    Watch
  3. 05

    Skills

    How to give an agent your team's knowledge: write it down once, have the agent load it only when a task calls for it, and keep the system prompt small however much you add.

    10:59 0 views Published
    Watch
  4. 06
    06

    Episode 6

    Coming soon
  5. 07
    07

    Episode 7

    Coming soon

Part threeThe benchmark

  1. 08
    08

    Episode 8

    Coming soon
  2. 09
    09

    Episode 9

    Coming soon