AI Agents - an introduction
A brief intro to AI agents.
AI Agents
A Brief Primer Shared under Build Club's learning commons — please share, not sell.
What Is an AI Agent?
The formal definition (Google):
"...software systems that use AI to pursue goals and complete tasks on behalf of users. They show reasoning, planning, and memory and have a level of autonomy to make decisions, learn, and adapt."
The plain-English version: chatbots that can push buttons.
Agents vs. Assistants vs. Bots
| AI Agent | AI Assistant | Bot | |
|---|---|---|---|
| Purpose | Autonomously and proactively perform tasks | Assist users with tasks | Automate simple tasks or conversations |
| Capabilities | Complex, multi-step actions; learns and adapts; makes decisions independently | Responds to prompts; provides info and completes simple tasks; can recommend actions but the user decides | Follows pre-defined rules; limited learning; basic interactions |
| Interaction | Proactive; goal-oriented | Reactive; responds to user requests | Reactive; responds to triggers or commands |
Why Computers Needed LLMs to Become Agents
Computers have always had a fundamentally 1D view of the world. Ask a computer to "draw a square" and it doesn't see a shape — it processes one pixel at a time, issuing a sequence of micro-instructions: "go straight for N pixels → rotate 90° clockwise → repeat."
It cannot see the whole screen. It has no concept of the goal — only the next instruction.
This matters for open-ended tasks. Imagine going grocery shopping if you could only see a tiny patch of the world at any given time. Every decision — which store, how to get there, what to do if the door is closed — requires flexible reasoning about incomplete information. Traditional programs handle this through control logic: explicit if/elif/else branches written in advance for every condition the programmer anticipated.
def choose_store(store):
if tesco.status == "open":
store = tesco
elif aeon.status == "open":
store = aeon
else:
store = 99
The problem: you can only handle situations you've already thought of. Real-world tasks have too many branches to pre-program exhaustively.
LLMs + Programs = AI Agents
The key insight is that LLMs and traditional programs are complementary:
- LLMs are good at reasoning, understanding context, and deciding what to do next — but bad at actually executing things
- Programs are good at executing reliably — but need to be told exactly what to do
An AI agent combines them: the LLM decides on a course of action given the current state, and programs (tool calls) execute that action.
def next_action(state):
prompt = {
"You are a troubleshooting agent."
f"Allowed actions: {', '.join(PERFORMANCE_ACTIONS)}."
f"Current state -> disk_space={state['disk_space']}%,"
f"high_cpu={state['high_cpu_processes']}."
"Respond with the format:\nAction: <one_action>\n"
}
reply = llm_chat(prompt)
return reply.split(":",1)[1].strip()
def handle_performance_ticket(state):
action = next_action_llm(state)
if action == "clean_temp_files":
clean_temp_files()
elif action == "kill_high_cpu_processes":
kill_high_cpu_processes()
elif action == "escalate_deep_malware_scan":
escalate("deep malware scan")
elif action == "close_ticket":
close_ticket()
The Five Parts of an AI Agent
1. Perception / Input Environmental triggers that kick the agent off — messages, API calls, sensor data, webhooks, scheduled events.
2. Decision-Making Logic The brain of the agent. Determines what actions need to be performed at what stage. Typically managed by an LLM, which reads the current state and selects the next action.
3. Loops Agents don't execute once and stop — they keep making decisions until the task is complete. The pattern is: initial decision → execute → reassess → next decision → repeat.
while True:
prompt = previous_steps + "if trip is booked return done"
status = LLM.eval(prompt)
if status == "done":
break
4. State Management As the agent acts, the world changes — and the agent needs to remember what it has already done to know what comes next. State can be stored in the prompt itself (short tasks) or in an external database like Redis or Supabase (longer-running or persistent agents).
5. Function Calls (Tools) LLMs can reason but can't directly interact with the world. We write programs that give them hands: calculators, web search, file management, calendar APIs, email clients — anything the agent needs to act on its decisions. This is the same mechanism that powers tools like Cursor.
Useful Agent-Building Tools
Workflow builders — visual, low-code agent construction:
- Zapier
- n8n
- Gumloop
- Make
Research / framework tools — for building custom agents in code:
- LangChain
- Exa (search)
Multi-agent control platforms — orchestrate multiple agents working together:
- Relevance AI
- CrewAI
- Lindy
Attached files