PaPoo
cover

The part I actually care about in “build an agent from scratch”

What stood out to me isn’t the toy order-status example. It’s the insistence on doing this in plain Python, without an orchestration framework, because that’s usually where the gloss falls off. A lot of “agent” writing makes the whole thing sound mystical. Here, the useful bit is more mundane: a model, a tool schema, a loop, and a place to put state. That’s close to the truth, and I think people should start there.

What I’m less sold on is the framing around “why you need an agent” as if the leap from LLM to agent is always obvious. Sometimes you do. Sometimes you just need a normal backend call wrapped around a model prompt, and calling it an agent adds ceremony without much value. The article’s example makes the gap look neat: the model can’t know live order data, so give it a tool. Fair enough. But in real systems, the hard part is not “can the model call a function?” It’s “when should it be allowed to, what should be cached, what gets retried, and what happens when the tool lies or times out?” That’s where the simple demo stops being simple.

The nicest thing about the piece is that it shows the mechanical shape of tool calling without pretending the model is doing real reasoning in some autonomous sense. The model asks, you execute, you feed back the result, then the model finishes the answer. That’s a helpful mental model, especially for anyone who has only used chat completions and wonders what makes an agent different. I think that clarity matters more than whatever language we use around “memory” or “autonomy.”

The memory part is where I’d be most cautious. Articles like this often make persistence sound like a feature you bolt on, when in practice it changes the entire behavior envelope of the system. Memory can help, sure. It can also accumulate stale assumptions and make debugging miserable. I’d want to know what exactly is being stored, how long it lives, and whether the article’s “memory” is really just chat history with a more flattering name. The source doesn’t seem to get into those uncomfortable details, which is probably fine for an intro, but it’s also the point where the real work begins.

What I’d actually try after reading this is the smallest possible version: one tool, one loop, one explicit state object, no framework. Not because frameworks are bad, but because if you can’t explain the control flow yourself, you don’t really own the system. This article pushes in that direction, and that part I like.


Reference: How (and Why) to Build an AI Agent from Scratch in Python

同じ著者の記事