Building your first AI agent from scratch
What an AI agent actually is, what a minimum viable one looks like, and the three parts every builder gets wrong the first time.
by AgentBoard
An AI agent is not a chatbot. A chatbot answers. An agent decides what to do, takes an action, observes the result, and decides again. That loop — plan, act, observe, repeat — is the whole thing.
The three parts every agent needs
A goal. Vague goals produce vague agents.
"Book me a flight"is not a goal;"Book me the cheapest non-stop from JFK to SFO on 15 March, aisle seat"is a goal. Everything downstream leans on this.Tools. The model itself only produces text. Tools are the ways that text turns into action — a search API, a shell, a browser, a database query. Give the agent too few and it stalls. Give it too many and it wanders.
A memory of what it just did. Without one, every step is a fresh conversation and the agent forgets the goal within three turns. The cheapest memory is "append everything to the prompt"; the most expensive is a vector store you did not need.
The three things every builder gets wrong
- Skipping the goal decomposition. The model can plan, but you get better agents by breaking the goal into 3–5 concrete sub-goals up front, then letting the agent execute each one.
- Building tools before knowing what tools are needed. Write the goal, walk through it as a human, note every action you took. Those are your tools. Not the ones the tutorial said.
- Ignoring the exit condition. Agents that don't know when they're done keep
going. Every loop needs a
stop when …clause the same way every function needs a return.
The minimum viable agent, in pseudo-code
while not done:
thought = model(goal, memory)
action = pick_tool(thought)
result = run(action)
memory.append((thought, action, result))
done = model_thinks_we_are_done(memory)
That's it. Everything else — frameworks, orchestrators, memory stores, planners — is an optimisation on top of that loop. Build the loop first.
What to try this week
Pick a task you do by hand every day that has a clear outcome and takes 5–15
minutes. Not "manage my email" (too vague), not "book a hotel" (too much money).
Something like "summarise these three articles and email me the top three findings." Build the smallest possible loop that does it. Ship. Then decide
what the second version needs — usually a better tool, not a better model.
Once you have that loop running for one task, everything after is variations on the same theme.