What Are AI Agents?
The simplest way to think about AI agents: your normal app + an LLM + a few functions ("tools") + a bit of logic that decides when to call them.
Mental Model (TL;DR)
Think of an AI agent as a traditional server app + LLM integration + function tools. The model plans and explains; the tools do real work (math, API calls, etc.); your server glues it together.
Hands‑on Demos
Website Builder
Describe a site; it generates a single‑file HTML you can preview.
Open Website BuilderUnderstand AI Agents through Simple Problems
Instead of abstract definitions, think in terms of tasks the agent can do via tools.
1) Sum of two numbers
A simple tool function:
function sum(a: number, b: number) {
return a + b;
}
2) Is a number prime?
Another small tool:
function isPrime(n: number) {
if (n < 2) return false;
if (n % 2 === 0) return n === 2;
for (let i = 3; i * i <= n; i += 2) {
if (n % i === 0) return false;
}
return true;
}
3) Crypto price (API)
Call a free API (e.g., CoinGecko):
async function getCryptoPrice(
symbol: string, vs = 'usd'
) {
/*
fetch from API and return price
e.g., https://api.coingecko.com/api/v3
/simple/price?ids=bitcoin&vs_currencies=usd
*/
}
4) Weather for a city (API)
Geocode + forecast API:
async function getWeather(
city: string,
unit: 'celsius' | 'fahrenheit' = 'celsius'
)
{
/*
geocode the city, then fetch weather
e.g., Open-Meteo geocoding
+ forecast endpoints
*/
}
From User Input to Function Calls
The model reads the user message and decides if a tool is needed. If yes, your server calls the right function with structured args, returns the result to the model, and the model explains the final answer.
- "is 97 prime?" → call isPrime(97)
- "btc price in usd" → call getCryptoPrice('btc','usd')
- "weather in London" → call getWeather('London')
How the Pieces Fit
- Your server/API routes host small, reliable tool functions.
- The LLM handles language understanding and planning.
- A tiny orchestrator loop decides which tool to call, feeds results back to the model, and stops when a final answer is ready.
- Optional: add context/memory by keeping recent chat history.