AWS Builder Center
From Chatbot to AI Agent with Amazon Bedrock

From Chatbot to AI Agent with Amazon Bedrock

Learn how to build AI agents with Amazon Bedrock that use tools, access data, and safely take real-world actions on AWS.

Software Engineer

Generative AI applications have evolved quickly.

The first wave of applications focused on one simple interaction:
User asks a question → AI generates an answer.
That model is useful, but real-world software often needs more than an answer.
Imagine telling an AI assistant:
“Check my order, find out why it is delayed, create a support ticket, and notify me when it is resolved.”
A traditional chatbot can explain how to perform these tasks.
An AI agent can potentially perform them.
This shift from generating responses to taking actions is one of the most interesting changes happening in modern AI application development.
In this article, we'll explore how to think about AI agents, how they differ from traditional chatbots, and how AWS services such as Amazon Bedrock, AWS Lambda, Amazon DynamoDB, and Amazon CloudWatch can be combined to build an action-oriented AI application.

From Answers to Actions

A traditional chatbot typically follows a simple architecture:
User
↓
Application
↓
Foundation Model
↓
Response

The model receives a prompt, generates a response, and the application displays it.
An agent introduces another layer of capability:
User
↓
Application
↓
AI Agent
↓
Reason about the request
↓
Select a tool
↓
Execute the tool
↓
Observe the result
↓
Continue reasoning
↓
Return the result

The important difference is that the model is no longer limited to producing text.
It can interact with external systems through controlled tools.
For example, an e-commerce support agent might have access to:
get_order_status()
create_support_ticket()
send_notification()

The AI determines which capabilities are needed based on the user's request.

What Exactly Is an AI Agent?

An AI agent is an application that combines a foundation model with tools, context, instructions, and a mechanism for taking actions toward a goal.
A simplified agent loop looks like this:
Understand
↓
Plan
↓
Choose Tool
↓
Execute
↓
Observe Result
↓
Decide Next Step
↓
Respond

The model provides the reasoning capability.
The application provides the environment in which the model operates.
The tools provide the ability to interact with the real world.
This leads to an important engineering principle:
The model should reason about actions, but your application should control what actions are actually possible.

A Practical Example

Let's build a conceptual customer-support agent.
A customer sends:
“My order #4821 hasn't arrived yet. Please check it and open a support ticket if it's delayed.”
A chatbot might respond:
“You can check your order status from the Orders section of your account.”
An agent could instead:
  1. Extract the order ID.
  1. Call  get_order_status .
  1. Inspect the returned status.
  1. Determine whether the order is delayed.
  1. Call  create_support_ticket .
  1. Return the ticket number to the customer.
The interaction becomes:
User
│
│ "Check order #4821"
▼
AI Agent
│
│ get_order_status(4821)
▼
Order Service
│
│ "Delayed"
▼
AI Agent
│
│ create_support_ticket(...)
▼
Support System
│
│ Ticket #19382
▼
AI Agent
│
▼
User

The user doesn't need to understand the underlying APIs.
They simply describe the desired outcome.

Building the Architecture on AWS

A practical AWS architecture could look like this:
┌──────────────────┐
│ User │
└────────┬─────────┘
│
▼
┌──────────────────┐
│ API Gateway │
└────────┬─────────┘
│
▼
┌──────────────────┐
│ Amazon Bedrock │
│ Agent │
└───────┬──────────┘
│
┌──────────────┼──────────────┐
│ │ │
▼ ▼ ▼
┌──────────┐ ┌──────────┐ ┌──────────┐
│ Lambda │ │ Lambda │ │ Lambda │
│ Tool #1 │ │ Tool #2 │ │ Tool #3 │
└────┬─────┘ └────┬─────┘ └────┬─────┘
│ │ │
▼ ▼ ▼
┌──────────┐ ┌──────────┐ ┌──────────┐
│ DynamoDB │ │ External │ │ SES │
│ │ │ API │ │ │
└──────────┘ └──────────┘ └──────────┘

┌──────────────────┐
│ CloudWatch │
│ Logs & Metrics │
└──────────────────┘

Each AWS service has a specific responsibility.

Amazon Bedrock

Provides access to foundation models and capabilities for building generative AI applications.
The model is responsible for understanding the user's intent and determining which available capability can help fulfill the request.

AWS Lambda

Lambda functions can act as controlled tools.
For example:
get_order_status
create_ticket
send_email

Each function should perform a well-defined operation.

Amazon DynamoDB

DynamoDB can store application data such as:
  • Orders
  • Customers
  • Support tickets
  • Agent state
  • Workflow metadata

Amazon CloudWatch

CloudWatch provides visibility into application behavior.
For an agentic application, observability becomes particularly important because a single user request can result in multiple model calls and tool executions.

The Tool-Calling Pattern

Tools are one of the most important concepts in agentic applications.
Suppose we expose this capability:
getOrderStatus(orderId)

The agent doesn't need to know how the underlying database works.
It only needs a clear description of the tool.
For example:
Tool: getOrderStatus

Purpose:
Returns the current status of an order.

Input:
orderId - The customer's order identifier.

Output:
Order status, expected delivery date, and delay information.

The model can then determine when the tool is relevant.
This creates a clean separation:
AI Model
│
│ decides what should happen
▼
Tool Interface
│
│ validates request
▼
Application Logic
│
│ performs operation
▼
AWS Infrastructure

This separation is extremely important for production systems.

Don't Give the Agent Direct Database Access

One tempting approach is to let the model directly interact with your database.
That is generally a bad abstraction.
Instead of:
AI → Database

prefer:
AI
↓
Controlled Tool
↓
Business Logic
↓
Database

Why?
Because business rules should remain deterministic.
Suppose your application has a rule:
Customers can receive refunds up to $500 automatically.
The model should not be responsible for enforcing that rule.
Your application should enforce it.
The agent can request:
issue_refund(order_id, amount)

But the backend should verify:
Is the user authenticated?

Is the order valid?

Is the refund allowed?

Is the amount within the permitted limit?

Has the refund already been issued?

Only after those checks should the operation execute.

AI Agents Need Guardrails

Giving an AI the ability to take action introduces a new security problem.
What happens if the model makes a wrong decision?
Consider an agent with access to:
delete_customer()
issue_refund()
send_email()
update_account()

These operations should not simply execute because the model requested them.
A production architecture should enforce authorization independently from the model.
For example:
User Request
↓
Agent
↓
Tool Request
↓
Authentication
↓
Authorization
↓
Input Validation
↓
Business Rules
↓
Execution

This is an important mindset shift:
Never treat the model's decision as authorization.
The model can recommend an action.
Your application decides whether that action is permitted.

Combining Agents With RAG

Agents often need access to information that isn't contained in the model's training data.
For example:
  • Internal documentation
  • Product manuals
  • Company policies
  • Knowledge bases
  • Customer support documentation
This is where Retrieval-Augmented Generation (RAG) can complement agents.
The architecture becomes:
User
↓
Agent
├── Retrieve information
│ ↓
│ Knowledge Base
│
└── Execute actions
↓
Tools

The distinction is useful:
RAG helps the AI know something.
Tools help the AI do something.
Combining both can create significantly more useful applications.

When Should You Use an Agent?

Not every AI application needs an agent.
If your application simply needs:
Question → Answer

a standard model invocation may be enough.
If you need:
Question → Retrieve Documents → Answer

RAG may be sufficient.
But if the application needs:
Goal
↓
Multiple decisions
↓
Multiple tools
↓
External systems
↓
Final result

an agent architecture becomes much more interesting.
A useful rule is:
Requirement
Possible approach
Generate text
Foundation model
Answer from private documents
RAG
Execute one deterministic operation
API/tool
Decide between multiple operations
Agent
Coordinate multiple specialized capabilities
Multi-agent architecture
The goal shouldn't be to use an agent everywhere.
The goal should be to use the simplest architecture that solves the problem.

The Hard Part Isn't the Prompt

One of the biggest misconceptions about AI agents is that building one is primarily a prompt-engineering problem.
It isn't.
A prototype can be created with a clever system prompt.
A production system requires much more.
You need to think about:
  • Authentication
  • Authorization
  • Tool design
  • Data validation
  • Retries
  • Timeouts
  • Idempotency
  • Rate limiting
  • Observability
  • Cost
  • Latency
  • Failure recovery
  • Human approval
  • Data privacy
For example, imagine an agent calling an external API.
The API fails.
Should the agent retry?
How many times?
What happens if the first request succeeded but the response was lost?
This is where traditional distributed-systems engineering becomes extremely important.
AI doesn't replace software engineering.
AI makes good software engineering even more important.

Designing Reliable Tools

Tools should be small and predictable.
Instead of creating one giant function:
handleEverything()

create focused capabilities:
getOrderStatus()
createSupportTicket()
sendNotification()

This makes tools:
  • Easier to test
  • Easier to secure
  • Easier to monitor
  • Easier for the model to understand
  • Easier to reuse
A good tool should have:
Clear purpose
Strict input schema
Predictable output
Explicit permissions
Useful error messages
The model should not need to guess how your application works.

Observability Becomes More Important

Traditional applications usually have a relatively predictable execution path.
An agent may behave differently.
A single request could result in:
1 model invocation
2 tool calls
1 retry
1 database query
1 external API call

Another request might require completely different steps.
This makes observability essential.
You should track things such as:
Request ID
User ID
Model invocation
Tool selected
Tool arguments
Tool execution time
Tool result
Errors
Retries
Token usage
Total latency

CloudWatch can be part of this observability layer.
The objective isn't simply to know whether the application failed.
You want to understand why the agent took a particular path.

Controlling Cost

Agentic systems can potentially be more expensive than simple chatbot applications.
Why?
Because one request can trigger multiple operations.
For example:
User Request
↓
Model Call
↓
Tool
↓
Model Call
↓
Tool
↓
Model Call
↓
Response

Every additional model interaction can increase latency and cost.
This makes architecture important.
Some useful strategies include:
  • Keep tools focused.
  • Avoid unnecessary agent loops.
  • Cache appropriate results.
  • Use smaller models for simple tasks.
  • Set maximum execution steps.
  • Monitor token usage.
  • Add timeouts.
  • Avoid unnecessary context.
The objective is not to maximize the number of agent steps.
It is to accomplish the task with the fewest reliable steps.

Single Agent vs. Multi-Agent

Once developers understand agents, the next temptation is to create multiple agents.
For example:
Supervisor Agent
/ | \
/ | \
Researcher Support Finance
Agent Agent Agent

This can be useful when different tasks require different expertise or tools.
But multi-agent systems also introduce additional complexity:
  • More model calls
  • More latency
  • More state management
  • More failure points
  • More debugging difficulty
  • Higher cost
Therefore, start with a single agent.
Introduce multiple agents only when there is a clear architectural reason.

A Production Mindset

When building an AI agent, I find it useful to ask five questions:

1. What can the agent decide?

Define the boundaries of model-driven reasoning.

2. What can the agent do?

Define its available tools.

3. What can the agent never do?

Define hard security boundaries.

4. How do we know what the agent did?

Build observability.

5. What happens when something fails?

Design failure handling before production.
These questions are often more valuable than trying to make the initial prompt more sophisticated.

The Bigger Picture

The most interesting part of AI agents isn't that they can generate better answers.
It's that they change the interface between humans and software.
For decades, users have interacted with applications through:
Menus
Buttons
Forms
Commands
APIs

Agents introduce another interface:
Intent

Instead of navigating through five screens to complete a task, a user can describe the outcome they want.
The software then determines which capabilities are needed to achieve it.
That doesn't mean traditional interfaces disappear.
Instead, agents become another layer on top of existing systems.

Remarks

The transition from chatbots to AI agents is not simply about adding a more powerful model.
It is about changing how we design software.
A chatbot primarily answers.
An agent can reason about a goal, use tools, interact with external systems, and produce an outcome.
AWS provides a strong foundation for experimenting with this architecture through services such as Amazon Bedrock, AWS Lambda, Amazon DynamoDB, Amazon CloudWatch, and other AWS building blocks.
But the most important lesson is architectural:
Don't give AI unlimited power. Give it well-designed tools, strict boundaries, and enough context to make useful decisions.
The future of AI applications may not be about building systems that simply know more.
It may be about building systems that can understand what we want, decide what needs to happen, and safely take the next step.
And that's the real shift:
From asking AI for an answer to giving AI a goal.
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article