agentpath
Learn how AI agents actually work by building a real one, from a single LLM call to a full agent harness.
Who this is for
You can program a little. You have never built anything with a language model, or you have used one through a framework and never understood what it was doing underneath. You do not need to know any machine learning. There is no maths in this course.
Why this exists
There are many tutorials that show you an agent loop. Almost all of them stop there. The tools people actually use every day, such as Claude Code and OpenHands, are not agent loops. They are harnesses, which means an agent loop surrounded by permission checks, saved sessions, context management, error recovery and a plugin protocol. Almost nobody teaches you to build that part.
This course goes all the way. You start by sending one HTTP request to a model and you finish with a harness you could actually use.
Every chapter also has a Thai version, which is rare for material at this depth.
What you will build
| Part | What it adds | Status |
|---|---|---|
| 1 Foundations | An agent that streams, calls tools, loops until the work is done, and can switch model providers | Available now |
| 2 Real Tools | File reading and editing, running shell commands, searching code, and a small coding agent that works | Available now |
| 3 The Harness | Permissions, saved sessions, context management, token economy, retrieval, error recovery | Available now |
| 4 Advanced | An MCP client, subagents, multi agent patterns, evaluation and model choice | Available now |
All four parts are finished, so the course is complete at 24 chapters.
Quickstart
Install uv, which is the Python installer and environment manager this course uses.
curl -LsSf https://astral.sh/uv/install.sh | sh
On Windows use PowerShell instead.
powershell -c "irm https://astral.sh/uv/install.ps1 | iex"
Then clone the repository and open the first chapter.
git clone https://github.com/Patchanon04/agentpath.git
cd agentpath
Now read lessons/00-setup/README.md. It walks you through choosing where your model runs, which can be free and local if you want, and setting the three environment variables the whole course uses.
The lessons
| Lesson | What you build |
|---|---|
| 00 setup | A working environment and a model you can reach |
| 01 first LLM call | One HTTP request to a model, with nothing hiding the wire |
| 02 conversation loop | A chat that remembers, and the discovery that models remember nothing |
| 03 tool calling | The model asks for a function and you decide whether to run it |
| 04 agent loop | Your first real agent, looping until the work is done |
| 05 streaming | Answers that appear as they are written, including the hard part where tool arguments arrive in fragments |
| 06 provider abstraction | One agent loop that works with two completely different APIs |
| 07 file tools | Reading and editing real files, with one gate deciding what may be touched |
| 08 shell tool | Running commands, and asking a person first |
| 09 search tools | Finding files and text, and why this beats a vector database for code |
| 10 anatomy of a prompt | The three places your words reach the model, including the one everyone forgets |
| 11 mini coding agent | Everything wired together into an agent that fixes a real bug |
| 12 permissions | A gate that remembers your answer, so it does not train you to stop reading it |
| 13 sessions | The conversation on disk, which is also the best debugging tool you have |
| 14 context management | Trimming a conversation without stranding a tool result, which is the trap everyone hits |
| 15 token economy | Why the same conversation costs more every turn, and what actually reduces it |
| 16 retrieval | Four questions that tell you whether you need RAG at all, and usually you do not |
| 17 errors and retries | Surviving rate limits, stuck models, and a person who changes their mind |
| 18 the harness | Everything wired together into a tool you could actually use |
| 19 MCP client | Using tools somebody else wrote, and what they cost you on every request |
| 20 subagents | Delegating a job to another agent, and the stale view that comes with it |
| 21 multi agent | Running several agents at once without their output turning to noise |
| 22 evals | Measuring whether a change helped, and choosing a model by evidence |
| 23 ship it | Packaging it, publishing it, and what to build next |
Using the finished framework
Everything the course builds also ships as a package, so you can install the finished version and read it as a reference.
pip install agentpath-kit
The distribution is called agentpath-kit and the package it installs is
called agentpath, so you install one name and import the other. That is
not a typo. PyPI refused the bare name because an abandoned package called
agent_path is close enough to it to be confusing, and splitting the two
names is the ordinary answer, the same one that has you install
scikit-learn and import sklearn. Installing plain agentpath gets you
somebody else's empty template, so the hyphen matters.
export AGENTPATH_BASE_URL=http://localhost:11434/v1
export AGENTPATH_MODEL=qwen3
agentpath chat
The command now has four subcommands. chat is an interactive session,
run does one task and exits, resume carries on from a session you
saved earlier, and eval runs a file of tasks and reports which ones passed.
An MCP server can be connected with --mcp, so the agent can use tools you
did not write.
The book
The chapters teach you to build it. There is also a book that explains why it is built that way, and how to think when you want to design your own. It is written in Thai, with the technical terms kept in English.
book/ has eleven chapters in two parts. The first seven are the theory behind the course. The last four are about taking an idea and working out what to build, with a long worked example of a LINE health assistant and three shorter ones that reach different answers.
How this repository is laid out
lessons/ holds one folder per chapter. Each folder is self contained, so you
can open any chapter and run its code without having done the others. The code
is duplicated between chapters on purpose, because a course where chapter four
silently depends on an edit you made in chapter two is a course people abandon.
src/agentpath/ holds the finished framework, which is the same ideas written
once and properly, with tests.
ci/ holds the script that runs every chapter check and the prose style check.
The fake model server it runs against lives in src/agentpath/testing/.
docs/ holds the design document, the implementation plans and the topic ideas
kept back for a second version.
Running the checks yourself
Every chapter has a check.py that proves the code you wrote actually works. You can run all of them at once against a fake model server, which costs nothing and needs no API key.
uv pip install -e ".[dev]"
python ci/run_lessons.py
This is the same script the project runs in continuous integration, so if it passes for you it passes for everyone.
Contributing
Issues and pull requests are welcome. Two rules matter more than the rest.
The course is frozen at 24 chapters. New topic ideas belong in docs/v2-ideas.md, not in a new chapter. If you want to add a chapter you have to argue for removing one.
Prose has a house style. No em dash, no emoji, and no colon in ordinary sentences. A check in continuous integration enforces the first two.
License
MIT. See LICENSE.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file agentpath_kit-1.0.5.tar.gz.
File metadata
- Download URL: agentpath_kit-1.0.5.tar.gz
- Upload date:
- Size: 47.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b2c29dd47a8a7f230688d52fe26d2aaba34e138e57630fa6f2a688a160c38efb
|
|
| MD5 |
80037fe2baf82d433e41fbff9fbbc3d5
|
|
| BLAKE2b-256 |
73f2d997163784d31ac732927a4aa265d9e17d82a0bdaca933ecada7353737a0
|
Provenance
The following attestation bundles were made for agentpath_kit-1.0.5.tar.gz:
Publisher:
publish.yml on Patchanon04/agentpath
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
agentpath_kit-1.0.5.tar.gz -
Subject digest:
b2c29dd47a8a7f230688d52fe26d2aaba34e138e57630fa6f2a688a160c38efb - Sigstore transparency entry: 2687182456
- Sigstore integration time:
-
Permalink:
Patchanon04/agentpath@50681e9e0a66f2e11e854c879cba8b8cfd9b39ab -
Branch / Tag:
refs/tags/v1.0.5 - Owner: https://github.com/Patchanon04
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@50681e9e0a66f2e11e854c879cba8b8cfd9b39ab -
Trigger Event:
push
-
Statement type:
File details
Details for the file agentpath_kit-1.0.5-py3-none-any.whl.
File metadata
- Download URL: agentpath_kit-1.0.5-py3-none-any.whl
- Upload date:
- Size: 58.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f140634a752856ad62427d0022bb1a96e9ce268b13a39290a2982f225ce3790a
|
|
| MD5 |
108f01458af14cec0163f8bcaefb14b6
|
|
| BLAKE2b-256 |
96a4c41a25797a86d0aa17abc3dd076c36f2e139160dfc815c2de0e3c1bdc52f
|
Provenance
The following attestation bundles were made for agentpath_kit-1.0.5-py3-none-any.whl:
Publisher:
publish.yml on Patchanon04/agentpath
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
agentpath_kit-1.0.5-py3-none-any.whl -
Subject digest:
f140634a752856ad62427d0022bb1a96e9ce268b13a39290a2982f225ce3790a - Sigstore transparency entry: 2687182684
- Sigstore integration time:
-
Permalink:
Patchanon04/agentpath@50681e9e0a66f2e11e854c879cba8b8cfd9b39ab -
Branch / Tag:
refs/tags/v1.0.5 - Owner: https://github.com/Patchanon04
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@50681e9e0a66f2e11e854c879cba8b8cfd9b39ab -
Trigger Event:
push
-
Statement type: