Lesson 1 of 4 Agentic AI on AWS

Understanding How AI Agents Plan, Act and Use Tools

This lesson explains how agents take foundation models beyond answering questions to completing tasks. They plan, call tools, observe the results and carry on until the goal is reached.

Learning outcomes

After completing this lesson, you will be able to:

  • Describe the reason-and-act loop that an agent follows.
  • Distinguish short-term from long-term agent memory.
  • Distinguish the patterns for coordinating several agents.
  • Explain what the Model Context Protocol (MCP) standardises.

How an agent works

An AI agent combines a foundation model (the reasoning engine) with tools, memory and a loop. Given a goal such as "rebook my cancelled flight", it repeats:

  1. Plan

    Decide the next step.

  2. Call a tool

    For example, search for flights or charge a card.

  3. Observe

    Read the result and decide what to do next.

This reason-and-act pattern is often called ReAct. Tools can be APIs, Lambda functions, databases, code execution, browsers or other agents. The model chooses a tool and its parameters through tool use (function calling), and the application runs it.

The following diagram shows the agent loop and the tools it can call.

How an AI agent works. A foundation model acts as the reasoning engine and repeats a loop towards a goal: it plans the next step, calls a tool such as an API, Lambda function, database or another agent, and observes the result. This reason-and-act pattern is called ReAct. Memory keeps context across steps. Through the Model Context Protocol (MCP), an MCP server exposes tools and resources that any MCP-compatible agent can use.
The loop repeats until the goal is met.
Match the pairs

Parts of an agent

Exam skills 2.1.6 · 3.1.6

An agent helps travellers rebook cancelled flights. Match each part of the agent with its role.

Log in to try this activity Interactive activities are free with an account.

Memory and context

An agent needs to remember information over two timescales. Short-term memory holds the current conversation and the steps the agent has taken in this task, so it can continue coherently. Long-term memory keeps facts and preferences across separate sessions, such as a customer's preferred seat, so the agent does not have to ask again next time. The following table summarises the two.

MemoryHolds
Short-termThe current conversation and steps
Long-termFacts and preferences across sessions, such as a preferred seat

Context engineering decides what goes into the limited context window at each step: instructions, relevant memories, tool results and retrieved documents.

Sort into groups

Short-term or long-term memory?

Exam skills 2.1.5 · 2.1.6

Decide which kind of memory each piece of information belongs in.

Log in to try this activity Interactive activities are free with an account.

Multi-agent systems

Complex tasks can be split among several specialised agents, coordinated in one of three patterns. In the supervisor pattern, also called orchestrator, one agent receives the task, delegates parts of it to specialised sub-agents and combines their results. In the sequential pattern, agents hand work to each other in a fixed order, such as from a research agent to a writing agent to a reviewing agent. In the collaborative pattern, peer agents work together without a single leader. The following table summarises the patterns.

PatternHow it works
Supervisor (orchestrator)Delegates to specialised sub-agents
SequentialHand-offs in a fixed order, for example from a research agent to a writer agent to a reviewer agent
CollaborativePeers work together

Workflow orchestration uses deterministic workflows for predictable processes and autonomous agents for open-ended ones.

Sort into groups

Which multi-agent pattern?

Exam skills 2.1.6

Name the coordination pattern each design uses.

Log in to try this activity Interactive activities are free with an account.

Connecting agents to tools: MCP

The Model Context Protocol (MCP) is an open standard for connecting AI applications to tools and data. An MCP server exposes tools and resources, such as a CRM or file system, and any MCP-compatible agent can use them, replacing one-off integrations. Agent-to-agent (A2A) protocols let agents from different systems work together.

True or false

Connecting agents

Exam skills 2.1.6

Check three claims about the protocols that connect agents to tools and to each other.

Log in to try this activity Interactive activities are free with an account.

Risks

Agents can take wrong or harmful actions if manipulated or if they misunderstand a request. Use least-privilege permissions, guardrails, human approval for high-impact actions, and full logging and tracing.

Worked example

Watching an agent work through a task

A customer writes: "My flight to Lisbon tomorrow was cancelled. Please rebook me on the earliest flight and keep my aisle seat." An airline agent with access to three tools works through the reason-and-act loop:

StepAgent reasonsTool callObservation
1I need the customer's bookingget_booking(customer_id)Flight TP101 cancelled; seat 14C (aisle)
2Find alternatives to Lisbonsearch_flights("LIS", date)TP103 at 09:10, TP105 at 14:30
3The earliest is TP103; check aisle seatsget_seats("TP103")12C and 20D free
4Rebook with an aisle seatrebook(booking, "TP103", "12C")Confirmed
5Done: reply to the customer—"You are on TP103 at 09:10, seat 12C."

Long-term memory supplied the fact that this customer always prefers aisle seats. The rebooking tool can change only this customer's booking (least privilege), and a rebooking that cost extra money would require the customer's approval, keeping a human in the loop for high-impact actions.

Check yourself

What is the Model Context Protocol (MCP)?

Show answer

An open standard for connecting AI applications and agents to tools and data sources through MCP servers, so the same tools can be reused by different agents.

Exam Tips

Remember for the exam

  • An agent combines a model, tools, memory and a planning loop.
  • When the model decides which function to call, that is tool use (function calling).
  • The standard way to connect agents to tools and data is the Model Context Protocol (MCP).
  • A supervisor agent delegating to specialists is multi-agent collaboration.
  • Remembering user preferences across sessions requires long-term memory.
  • High-impact actions by an agent should require human approval.