← All free lessons / Agents & Automation

What is an AI Agent?

What is an AI Agent?

Most AI interactions are simple: you send a message, the model responds, done. But a more powerful pattern is emerging: AI agents — systems where a language model doesn't just respond to a single prompt, but takes a sequence of actions to accomplish a goal.

Understanding agents is increasingly important as they move from research curiosity to practical tools.

The Defining Characteristics

What makes something an agent rather than just a chatbot?

Goals over turns: an agent is given a goal ("book me a flight to Edinburgh for next Tuesday") not just a single prompt. It works towards the goal over multiple steps.

Tool use: agents can take actions — call APIs, search the web, read and write files, execute code, query databases. The model decides which tools to use and when.

Autonomy: the agent operates without human approval for each step. It decides its own next action based on the current state and goal.

Observation-action loops: the agent takes an action, observes the result, and decides what to do next. This loop continues until the goal is achieved or the agent decides it can't proceed.

The ReAct Pattern

The most common agent architecture is ReAct (Reasoning + Acting):

  1. Reason: think about what to do next given the current state and goal
  2. Act: call a tool or take an action
  3. Observe: receive the result of that action
  4. Repeat until done

For example, an agent asked to "find the current CEO of OpenAI and summarise their background" might:

  1. Reason: I need to search for the current CEO
  2. Act: call web search("OpenAI CEO")
  3. Observe: search returns that Sam Altman is CEO
  4. Reason: now I need to find background information
  5. Act: call web search("Sam Altman background career")
  6. Observe: results with career history
  7. Reason: I have enough information
  8. Generate final summary

Each step is a model call. The model decides what to do next based on the accumulated context.

Why Agents Are Powerful (and Risky)

Power: agents can complete tasks that require multiple steps, external data, and real-world actions. They can automate workflows that would take humans hours.

Risks:

  • Irreversibility: an agent that sends emails, deletes files, or submits orders can cause harm that's hard to undo
  • Error propagation: a mistake in step 2 compounds through steps 3, 4, 5...
  • Prompt injection: if the agent reads external content (emails, web pages), that content could contain instructions designed to hijack the agent's behaviour
  • Cost: multi-step agents make many API calls — costs multiply
  • Reliability: current LLMs make mistakes. An agent that runs 20 steps has 20 opportunities to go wrong

Best practice: start with human-in-the-loop agents where a person approves actions before they're taken. Expand autonomy gradually as you develop confidence in reliability.

Sign up free to take the quiz, earn XP, and track your progress.