Station 8 · Building Agents
You now know the parts — an LLM + tools + a loop. But how do you wire them together in real code? There are three paths, and they trade off the same thing: how much control you want versus how fast you want to be running.
What you'll walk away with
Concept 1
Every agent is the same recipe underneath. What changes is who writes the plumbing — you, the model provider, or a framework. Here they are, from most control to most convenience.
You write the LLM API calls, the loop, and the tool-parsing yourself. Most work — but you see every gear turn. Best for learning.
The model returns a structured tool request; you just run it. No fragile text parsing — but the loop is still yours.
Pre-built agent machinery — loop, memory, tool wiring — already done. You assemble instead of build. More magic, less control.
Going down the list, you write less code and get running faster — but you also hand away visibility into what your agent is actually doing.
From scratch is cooking from raw ingredients — total control, most effort, and you learn how everything works. Function calling is a meal kit: the tricky prep is done, but you still cook it your way. A framework is a restaurant: fastest to a plate of food, but you don't decide how it's made. None is "best" — it depends on whether you're learning, shipping, or in a hurry.
Concept 2
This is the agent loop with nothing hidden. You own every step:
Because you understand it forever. When something breaks, you know exactly which gear jammed. This is precisely what Level 2 has you build by hand — the most control, the most work, and the best way to truly get agents.
Concept 3
The painful part of Path 1 is guessing whether the model wanted to call a tool by reading its text. Function calling removes that guesswork: the model itself hands you a structured tool request — you just run it.
You'll see this same idea under a few names, one per provider:
The original name for it — plus the higher-level Assistants API that also manages the loop for you.
Google's flavor of the same structured tool-request mechanism.
Claude's version — same concept, called "tool use." You define tools; Claude asks to run them.
A step further: it wraps function calling and runs the agent loop, nudging you toward Path 3.
How it works, in three beats: you define a tool (its name and inputs), the model requests it (as clean structured data, not prose), and you execute it and send the result back. Less parsing — but the loop is still yours to run.
# 1 — You DEFINE a tool (name + what inputs it takes) tools = [{ "name": "get_weather", "description": "Get current weather for a city", "input_schema": {"city": "string"} }] # 2 — The MODEL requests it — as structured data, not text you parse reply = model.call(messages, tools=tools) # reply.tool_call → { name: "get_weather", args: { city: "Austin" } } # 3 — YOU execute it, then hand the result back to the model if reply.tool_call: result = get_weather(reply.tool_call.args) # 41°F, raining model.call(messages + [result]) # loop continues
Concept 4
Why write the loop, memory, and tool wiring at all? Frameworks ship all of it pre-built. You configure and assemble instead of coding from zero — the fastest route to a working agent.
Names you'll bump into (you don't need to know them all — just recognize the category):
The most popular toolkit; LangGraph adds explicit control over multi-step agent flows.
Strong when your agent needs to search and reason over your own documents.
Built for multiple agents working together as a team, each with a role.
A newer, lightweight framework aimed at getting an agent running fast.
Fast to start, but the machinery is hidden. When your agent misbehaves, the bug is buried inside code you didn't write — and that's exactly why learning Path 1 first pays off. Convenience is great once you understand what it's hiding.
Checkpoint
What is the main thing "function calling" saves you from, compared to building from scratch?
From scratch, you read the model's prose and guess whether it wanted a tool. With function calling, the model returns a clean, structured request — the tool name and its arguments — so the fragile parsing disappears. The loop is still yours to run, and tools are still essential; only the guesswork is gone.
See it yourself — 5 minutes
You don't need to code anything yet — just build a mental map. Try this:
Recap. Three ways to build an agent, one trade-off — control vs. speed. From scratch gives you total control and the deepest understanding. Function calling (OpenAI, Gemini, Claude tool use, Assistants API) removes the fragile parsing while keeping the loop yours. Frameworks (LangChain, LlamaIndex, CrewAI, and friends) get you running fastest, at the cost of hidden machinery. Want to build one from scratch hands-on? That's exactly what Level 2 walks you through.