Introduction

An AI agent on AWS is assembled from several managed components. This guide describes those components and the order in which they are combined. Readers who are new to the underlying ideas should first read the guides on AI agents, Amazon Bedrock, and retrieval-augmented generation.

What is being built?

An agent is built from a model that reasons, tools that act, knowledge that grounds the answers, a mechanism that coordinates the steps, controls that keep it safe, and monitoring that makes its behavior visible. On AWS, the model is provided by Amazon Bedrock, the tools are usually AWS Lambda functions, the knowledge is provided by a Knowledge Base, and the coordination is managed by Bedrock Agents or by AWS Step Functions. AgentCore is a set of managed capabilities that support the running of agents, including memory and secure tool access.

Why assemble it this way?

Each component addresses a different concern. Using a managed model removes the need to host large models. Implementing tools as functions keeps actions small and controllable. Grounding the answers in a Knowledge Base improves accuracy. Coordinating the steps with a managed service adds reliability. Applying controls and monitoring keeps the agent safe and observable. Assembling these managed parts is faster and more reliable than building each from the beginning.

How it is built

The construction usually follows these steps. First, a foundation model is chosen in Amazon Bedrock to suit the task. Second, the tools are defined, each as a Lambda function with a clear description. Third, a Knowledge Base is added if the agent must draw on private documents, which applies retrieval-augmented generation. Fourth, the reasoning loop is coordinated, either by a Bedrock Agent or by a Step Functions workflow. Fifth, guardrails are applied so that unsafe content and actions are prevented. Sixth, observability is added through Amazon CloudWatch so that behavior can be traced. Finally, the components are deployed as serverless services so that capacity scales with demand.

Architecture diagram

Amazon Bedrock model (reasoning) | +---------------+----------------+ | | | Tools Knowledge Base Guardrails (Lambda) (RAG grounding) (safety filters) | | +-------+-------+ | Coordination (Bedrock Agent or Step Functions) | v Observability (Amazon CloudWatch), deployed serverless

Advantages

Disadvantages

Common use cases

Best practices

Common mistakes

Further reading in this library

Frequently Asked Questions

Which AWS services are needed to build an agent?
A model is provided by Amazon Bedrock, the tools are commonly AWS Lambda functions, grounding is provided by Bedrock Knowledge Bases, coordination can be managed by Bedrock Agents or by AWS Step Functions, and Amazon CloudWatch is used for observability.
Does a model need to be hosted?
No. Amazon Bedrock provides foundation models as a managed service, so no model needs to be hosted. The application sends prompts and receives responses through the Bedrock interface.
How are the tools of an agent implemented?
A tool is usually an AWS Lambda function that performs an action or returns data. The agent is given a description of each tool, and the model chooses which to call and with what input.
How is an agent kept safe and cost-controlled?
Safety is improved with guardrails, least-privilege permissions, and human approval for sensitive actions. Cost is controlled by choosing an appropriate model, limiting the number of steps, and monitoring token usage.
What is a multi-agent system?
A multi-agent system uses several agents that each handle part of a task and coordinate with one another, which can improve the handling of complex work at the cost of greater coordination complexity.
Building AI Agents on AWS cover
Go deeper ยท Book as a Service™
Building AI Agents on AWS

This article is the summary. The book is the full, continuously updated reference: Bedrock, AgentCore, tools, Knowledge Bases, guardrails, and production multi-agent systems on AWS.

View the book