InfoWok
// series · 6 parts

AI Agents from Scratch in Python

The Python for AI agents you actually need to read the code: dicts, functions, type hints, loops, async, and setup — explained simply for beginners.

SK
Sukhveer Kaur
Updated Jun 20, 2026
~38 min
Total read
Beginner
Level
6 parts published
// the path
00
Python for AI Agents: The Basics to Read the Code (Part 0)
The Python for AI agents you actually need to read the code: dicts, functions, type hints, loops, async, and setup — explained simply for beginners.
6 min
✓ Published
01
Call an LLM in Python: The First Building Block of an Agent
Call an LLM in Python with real OpenAI and Anthropic code: system vs user prompts, temperature, JSON output, and why one call isn't yet an agent.
6 min
✓ Published
02
Tool Calling in Python: Make an LLM Use Your Functions
Tool calling in Python from scratch: define a tool, parse the model's request, run your function, and return the result — with real, current OpenAI code.
7 min
✓ Published
03
AI Agent Loop in Python: Build a ReAct Agent From Scratch
Build an AI agent loop in Python from scratch: a framework-free ReAct agent that thinks, calls a tool, observes the result, and repeats until the job is done.
7 min
✓ Published
04
AI Agent Memory in Python: Short-Term Memory From Scratch
Add AI agent memory in Python from scratch: keep the conversation in a messages list, then trim and summarize older turns to fit the model's context window.
7 min
✓ Published
05
From Scratch to LangGraph: When to Stop Hand-Building AgentsLATEST
From scratch to LangGraph: the four walls that tell you when to use LangGraph instead of a hand-built Python agent loop — and when plain Python is still the right call.
5 min
✓ Published