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
Advantages
- Managed components. The heavy parts, such as the model, are operated by AWS.
- Serverless scale. Capacity matches demand and idle capacity is not paid for.
- Grounded answers. A Knowledge Base improves accuracy.
- Controllable. Guardrails and least-privilege permissions limit risk.
Disadvantages
- Several moving parts. The components must be configured to work together.
- Cost. Model calls and retrieval add to the cost and must be monitored.
- Unpredictability. The model's decisions require guardrails and monitoring.
- Evolving practices. The tools and services in this area change quickly.
Common use cases
- An assistant that answers questions from private documents and takes actions.
- Automation of a multi-step process that requires reasoning at each step.
- A support agent that looks up account data and updates records.
- A system of several agents that each handle part of a larger task.
Best practices
- The simplest design that meets the requirement should be chosen before more agents or tools are added.
- Each tool should be given only the permissions it requires, following the principle of least privilege.
- Guardrails and, for sensitive actions, human approval should be applied.
- Token usage and behavior should be monitored so that cost and errors are controlled.
Common mistakes
- Many agents and tools are added before a simple design has been proven.
- Tools are granted broad permissions, which increases risk.
- Guardrails and monitoring are omitted, so unsafe or costly behavior is not caught.
- A Knowledge Base is not used, so answers are not grounded in the required data.
Related AWS services
- Amazon Bedrock provides the model, Knowledge Bases, Agents, and guardrails.
- AWS Lambda implements the tools that the agent calls.
- AWS Step Functions can coordinate the steps of a complex agent.
- Amazon CloudWatch provides observability of the agent's behavior.
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.
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