AI

What building AI agents taught me about thinking

Agents fail like interns, not like code — and that changes how you design them.

SJ

Sadman Mubassir Jarif

Jan 2026 • 6 min read

When I built my first AI agent, I expected it to behave like a function: input in, correct output out. Instead it behaved like a keen but careless intern — fast, confident, and wrong in creative ways.

That single reframing changed everything about how I design. You don't write agents; you manage them. You give them narrow tools, clear checklists, and a supervisor (you, or code) that verifies the work.

The three failures I kept seeing

First, infinite loops: the agent retries the same failing step forever. Fix: step budgets and a rule that says after two failures, escalate instead of retrying.

Second, hallucinated tool results: it would summarize a page it never actually fetched. Fix: every claim must reference a tool output ID, or it doesn't count.

Third, vague goals: 'research the market' means nothing. Fix: force the goal into verifiable sub-tasks before the loop starts.

What actually works

Small tools beat big tools. A search tool that returns three clean snippets outperforms one that dumps whole pages. Constraints are a feature.

Approval checkpoints feel slow but build trust fast. Letting a human approve the plan before execution cut my error rate more than any prompt tweak.

Evals matter even for side projects. I keep five test goals and re-run them after every change. If a 'fix' breaks two of them, it wasn't a fix.

The bigger lesson

Building agents taught me to think in systems: goals, feedback loops, failure modes. That mindset now shows up in everything I build — chatbots, study tools, even my own study routine.

I'm still early in this journey. But if you're starting: build the smallest agent that can fail, watch exactly how it fails, and design the guardrails from what you see — not from what you imagine.

Enjoyed this? Let's talk about it.

I write to think clearly. If this sparked an idea — a project, a disagreement, a collaboration — I want to hear it.

Get in touch