AI Agents
Beginner 11 min read AI Agents

AI Agents Overview

Goals, loops, and tools

An agent is a model in a loop: it plans, calls tools, observes results, and iterates toward a goal — autonomously or with human checkpoints. Agents turn single-shot LLM calls into goal-driven systems.

agentloopgoalautonomytool useorchestration
Prerequisites: Tool Use
Before we start

What you will learn

  • Define what makes something an agent
  • Map the agent loop and its stages
  • Set the right autonomy level per task
Introduction

What is this?

An agent is a system where a model drives a loop toward a user goal: interpret the goal, plan, invoke tools, observe results, revise, repeat — until completion or a stop. Unlike a one-shot call, an agent holds state, acts, and adapts. Autonomy ranges from fully supervised (approve each step) to fully autonomous (bounded by caps).

Motivation

Why do you need it?

  • Complex goals need multiple steps and real-world inputs.
  • Loop structure makes behavior inspectable and evaluable.
  • Tool access turns understanding into action.
  • Explicit stop conditions keep autonomy safe and bounded.
Think about it

Mental model

Imagine

A junior engineer with a task board

Think of

An AI agent

They read the ticket (goal), break out steps (plan), check the docs and run tests (tools), see results, iterate, and check in at decision points (human checkpoints). You gave them the board, not the keys to the kingdom.

Mechanics

How it works

  • Define the goal and success criteria.
  • Give the agent tools + a loop (see agent-loop).
  • Let it plan, act, observe, revise — with caps.
  • Decide autonomy: approvals for high-stakes steps.
  • Evaluate completion quality and safety.

The agent pattern.

Goal
Plan
Act
Observe
Revise
Done
Real world

In production

  • Customer-service agents ticket, research, and draft replies.
  • Research agents gather and synthesize across sources.
  • DevOps copilots diagnose, fix, and verify infrastructure issues.
Guidelines

Best practices

  • Start supervised: approvals for anything consequential.
  • Give every loop a cap and a clear done-condition.
  • Log each step for eval and debugging.
  • Treat the agent as a bounded worker, not a free agent.
Watch out

Common mistakes

  • No success criteria — the loop stops by vibes.
  • Full autonomy from day one.
  • Silent steps: users can't see or audit progress.
Root cause analysis

Common issues

Error
Agent drifts from the user's goal
Root cause

Goal ambiguity

Fix

Restate the goal each loop; keep criteria visible.

Error
Too many approvals kills momentum
Root cause

Overly cautious gates

Fix

Auto-approve known-safe reads; gate only writes/costly acts.

When things break

Debugging tips

  • Agent loops forever → missing stop condition or cap.
  • Wrong goals met → success criteria vague; tighten.
  • Steps unreproducible → log inputs/outputs per step.
Interviews

Interview checkpoint

Practice

Hands-on lab

Run a Deterministic Agent Loop
25 min · beginner
In progress
Objectives
  • Represent a plan as an ordered list of actions
  • Execute actions with a done condition and a step cap
  • Trace every step and result for post-hoc inspection

Run a Deterministic Agent Loop

25 min · beginner

0/3 steps
0%
sandbox · Linux sandbox
$
Try these commands
Test yourself

Quick quiz

0/2
1

The defining features of an agent:

2

High-stakes steps should start with human approval.

Go deeper

Official documentation