LearnAILevel 1.5 · Agents ← Roadmap

Station 8 · Building Agents

How you actually build one

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.

8 of 10 · ~8 min

What you'll walk away with

Concept 1

Three paths, one trade-off

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.

Most control

1 · From scratch

You write the LLM API calls, the loop, and the tool-parsing yourself. Most work — but you see every gear turn. Best for learning.

Sweet spot

2 · Function calling

The model returns a structured tool request; you just run it. No fragile text parsing — but the loop is still yours.

Fastest start

3 · Frameworks

Pre-built agent machinery — loop, memory, tool wiring — already done. You assemble instead of build. More magic, less control.

↔️ The trade-off

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.

🍳 Analogy: three ways to get dinner

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

Path 1 — From scratch (manual)

This is the agent loop with nothing hidden. You own every step:

🔑 Why bother doing it the hard way?

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

Path 2 — LLM-native function calling

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:

🟢 OpenAI function calling

The original name for it — plus the higher-level Assistants API that also manages the loop for you.

🔵 Google Gemini function calling

Google's flavor of the same structured tool-request mechanism.

🟣 Anthropic (Claude) tool use

Claude's version — same concept, called "tool use." You define tools; Claude asks to run them.

🟢 OpenAI Assistants API

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.

function_calling.py
# 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
what changedNo more guessing from prose — the model literally returns which tool and which arguments. You still own the loop, but the fragile parsing is gone.

Concept 4

Path 3 — Frameworks

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):

🦜 LangChain · 🕸️ LangGraph

The most popular toolkit; LangGraph adds explicit control over multi-step agent flows.

🦙 LlamaIndex · 🔍 Haystack

Strong when your agent needs to search and reason over your own documents.

🤖 AutoGen · 👥 CrewAI

Built for multiple agents working together as a team, each with a role.

⚡ Agno

A newer, lightweight framework aimed at getting an agent running fast.

⚠️ The catch with frameworks

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?

It writes the entire agent loop for you. You no longer have to parse the model's text to detect a tool call — it comes back as structured data. It removes the need for tools entirely.

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

Match the tool to the path

You don't need to code anything yet — just build a mental map. Try this:

  1. Open the docs for one provider's tool feature — search "Anthropic tool use" or "OpenAI function calling." Notice it's just: define a tool → model requests it → you run it.
  2. Now skim a framework's landing page — search "CrewAI" or "LangChain agents." Notice how much is already done for you (and how much is hidden).
  3. Ask yourself for a project you'd want to build: do you want to learn (from scratch), ship cleanly (function calling), or move fast (framework)?

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.