← All lessons
AWS generative AI developer exam prep · Lesson 8 of 17

Agents, tools and MCP

An agent is a model in a loop: it reads the goal, decides which tool to call, gets the result, and repeats until it can answer. This reason-then-act pattern is called ReAct. Tools are functions you describe with a name, a description and a parameter schema; the model asks for a call, your code (or the service) runs it and returns the result. The model never runs anything itself.

Amazon Bedrock Agents is the managed option. You give an agent instructions, a model, knowledge bases, and action groups: the tools it can use, described with an OpenAPI schema or simple function definitions, and usually carried out by a Lambda function. Bedrock runs the loop, keeps session state, and can show a trace of each reasoning step. With return of control, the agent hands the chosen action and its parameters back to your app to carry out instead of calling Lambda, which suits actions that need the user's session or a human check.

Amazon Bedrock AgentCore is for running agents you build with any framework, in production. Its parts can be used separately: Runtime (serverless hosting with isolated sessions), Memory (short and long-term), Gateway (turns APIs and Lambda functions into tools agents can call, including over MCP), Identity (lets agents act for a user or with their own credentials), Observability (traces and metrics), plus a sandboxed Code Interpreter and a cloud Browser. Strands Agents is AWS's open-source SDK for writing agents in a few lines of code, and AWS Agent Squad is an open-source framework for routing between several specialized agents.

The Model Context Protocol (MCP) is an open standard for connecting models to tools and data. An MCP server exposes tools; an MCP client (inside the agent) discovers and calls them. A small, stateless MCP server fits in a Lambda function; one with heavy dependencies or long-lived connections suits a container on Amazon ECS. One server can serve many agents.

Multi-agent systems split work: a supervisor agent routes a request to specialists (billing, shipping, returns) and combines their answers. It's easier to test each specialist, but every hop adds latency and cost, so use it when the domains really differ.

Agents need limits. Cap the number of steps or loops, set timeouts (on Lambda, and on the whole workflow with Step Functions), give each tool's role the least IAM permissions it needs, validate tool parameters in code before acting, and require a person to approve anything risky (refunds, deletes, emails to customers). Step Functions can pause for a human with a task token until someone approves, and Amazon Augmented AI (A2I) builds human review into ML workflows.

Practice

A company wants an assistant that looks up orders through an existing REST API and answers from a policy knowledge base, with the least custom orchestration code. What fits?

More info

Quick reference

ReActReason, act with a tool, observe, repeat.
Action groupA Bedrock agent's tools: OpenAPI or function schema, often Lambda.
Return of controlThe agent hands the chosen action back to your app.
AgentCoreRuntime, Memory, Gateway, Identity, Observability, Code Interpreter, Browser.
Strands Agents / Agent SquadAWS open-source agent SDK / multi-agent router.
MCPOpen protocol: servers expose tools, clients call them.
Task tokenStep Functions waits until an outside step reports back.

Related courses