Introduction
An AI agent is a system that uses a model to decide on and take actions toward a goal. The model at its center is usually a foundation model, which is a large model trained on a broad range of data. Where a simple assistant only produces text, an agent is able to call tools and act. This guide explains what an AI agent is, why the idea exists, how it operates, and when it is appropriate. A general overview of the models involved is provided in the guide on Amazon Bedrock.
What is it?
An agent combines three elements. The first is a model that performs reasoning, which is the process of working out what to do next. The second is a set of tools, where a tool is a function or an interface that the agent can call to perform an action or to obtain information. The third is a loop that repeats until the goal is reached. Because the agent can act rather than only reply, it can complete tasks that a text-only assistant cannot.
Why does it exist?
A foundation model on its own can produce text, but it cannot look up current information, change a record, or interact with other systems. Many useful tasks require these actions. The agent pattern exists so that the reasoning of a model can be combined with the ability to act, which allows the model to accomplish goals in the real world rather than only describe them.
How it works
The model is given the goal and a description of the tools that are available. It reasons about the next step, selects a tool, and provides the input for that tool. The tool is executed, and its result is returned to the model. The model observes the result and either takes a further step or concludes that the goal has been reached. This repeated cycle of reasoning, acting, and observing is often called the reasoning loop. The ability of a model to request a tool with specific input is known as tool use or function calling.
Architecture diagram
Advantages
- Action. Tasks are completed rather than only described.
- Adaptability. The steps are chosen at run time rather than fixed in advance.
- Tool use. Existing systems and data can be reached through tools.
- Automation. Multi-step tasks can be handled with little human involvement.
Disadvantages
- Unpredictability. The model's decisions are not fixed, so behavior can vary.
- Cost. Several model calls may be required to complete one task.
- Error handling. A wrong decision or a failing tool must be handled carefully.
- Security. Giving an agent the ability to act requires the permissions of its tools to be controlled.
Common use cases
- Customer support that looks up account information and takes action.
- Retrieval of information from several sources in response to a question.
- Automation of multi-step business processes.
- Assistants that help with writing and analyzing code.
Best practices
- The set of tools should be limited to those that the task requires.
- Each tool should be given only the permissions it needs, following the principle of least privilege.
- Guardrails should be applied so that unsafe actions are prevented.
- Sensitive actions should require human approval, and behavior should be monitored.
Common mistakes
- Too many tools are provided, which makes the agent's choices harder to predict.
- Tools are given broad permissions, which increases the risk of a harmful action.
- No guardrails or approval steps are added for sensitive operations.
- Behavior is not monitored, so errors and unexpected actions go unnoticed.
Related AWS services
- Amazon Bedrock provides the model that performs the reasoning.
- AWS Lambda commonly implements the tools that an agent calls.
- AWS Step Functions can coordinate the steps of an agent workflow.
Frequently Asked Questions
- What is the difference between an AI agent and a chatbot?
- A chatbot produces a text reply. An AI agent goes further by deciding on and taking actions, such as calling a tool to fetch data or update a record, in order to complete a task.
- What are tools in the context of an agent?
- A tool is a function or an interface that the agent can call to perform an action or to obtain information. The model chooses which tool to use and with what input.
- How does an agent decide what to do?
- The model is given the goal and a description of the tools. It reasons about the next step, selects a tool, observes the result, and repeats until the goal is reached. This cycle is often called the reasoning loop.
- Are AI agents reliable?
- An agent can behave unpredictably, because the model's decisions are not fixed. Reliability is improved by limiting the tools, applying guardrails, monitoring behavior, and requiring human approval for sensitive actions.
- How are AI agents built on AWS?
- The reasoning is provided by a foundation model in Amazon Bedrock, the tools are commonly AWS Lambda functions, and the coordination can be managed by Bedrock Agents or by AWS Step Functions.
This article is the summary. The book is the full, continuously updated reference: agent design, tool use, orchestration, guardrails, and multi-agent systems on AWS.
View the book