Building Agents with Amazon Bedrock Agents
This lesson explains how an AI agent uses a foundation model to plan steps, call tools and act on results until a goal is reached, and how Amazon Bedrock Agents builds such agents with configuration rather than code.
Learning outcomes
After completing this lesson, you will be able to:
- Describe the agent loop.
- Configure a Bedrock agent with instructions, action groups and knowledge bases.
- Use traces to understand an agent's decisions.
How agents work
An agent runs a loop: the model reads the user's request, its instructions and the available tools, decides on an action (call a tool, query a knowledge base, ask the user or answer), observes the result and repeats. This reasoning and acting pattern lets agents handle multi-step tasks, such as checking an order, applying a refund policy and issuing a credit, that a single prompt cannot. Agents are useful when the sequence of steps is not known in advance; when it is, a deterministic workflow such as Step Functions is simpler and more predictable.
The following diagram shows the agent loop.

One agent turn
Bedrock Agents components
A Bedrock agent is configured with a foundation model, instructions that describe its role and rules, action groups and knowledge bases. An action group defines tools with an OpenAPI schema or function details; when the agent calls a tool, Bedrock invokes a Lambda function with the parameters, or uses return of control to send the parameters back to the application, which runs the action itself, useful for user confirmation or actions in client systems. Agents can also use a code interpreter, user confirmation before actions, memory across sessions, guardrails and prompt templates that can be overridden.
The following diagram shows the knowledge base and action groups of an agent that handles product returns.

Bedrock Agents parts
Traces and orchestration
Agents make decisions in several steps, so when an agent behaves unexpectedly, the final answer alone does not explain why. Enabling trace on an InvokeAgent request returns the agent's reasoning at each step, the action group and knowledge base calls it made, their inputs and outputs, and any guardrail interventions.
Traces are essential for debugging: they show whether the agent chose the wrong tool, passed wrong parameters, received an error from a tool or misread a result. The following table summarises the components of Bedrock Agents.
| Component | Purpose |
|---|---|
| Instructions | Role, goals and rules for the agent |
| Action group (OpenAPI or function schema) | Tools the agent can call |
| Lambda executor | Runs the tool logic |
| Return of control | Application runs the action, for example after user approval |
| Knowledge base | RAG over documents |
| Trace | Step-by-step reasoning and tool calls for debugging |
A returns agent
A retailer wants an assistant that can look up an order, check eligibility under the returns policy and create a return label after the customer confirms.
- Knowledge base: returns policy documents.
- Action group
orderswith a functionget_order(order_id)backed by a Lambda function that reads DynamoDB. - Action group
returnswithcreate_label(order_id)using return of control, so the web application asks the customer to confirm before calling the label service.
The agent decides the order of steps per conversation. Return of control keeps the irreversible action under the application's control, which is safer than letting the agent call the label service directly.
What does return of control do in Bedrock Agents?
Show answer
It returns the action to the application, which runs or confirms it instead of a Lambda function.
Exam Tips
Remember for the exam
- Unknown sequence of steps with tools: agent; fixed sequence: Step Functions.
- Bedrock Agents tools: action groups with OpenAPI or function schemas and Lambda.
- Application must run or confirm the action: return of control.
- Debug agent reasoning and tool calls: enable trace.
- Agents can use knowledge bases and guardrails.