Building Reliable AI Agents: Why Tool Execution and Verification Matter More Than Prompting
.
Building Reliable AI Agents: Why Tool Execution and Verification Matter More Than Prompting
Introduction
AI agents are rapidly moving beyond simple question-and-answer applications.
Modern AI systems can search information, call APIs, interact with databases, create documents, send messages, and perform multi-step tasks. This makes them much more useful—but it also introduces a fundamental engineering problem:
How do we know that an AI agent actually did what it claimed to do?
A language model can produce a convincing response even when an action failed, information was missing, or the model misunderstood the task.
For this reason, building reliable AI agents requires more than improving prompts or choosing a more capable model.
A production-ready agent needs tools, state, permissions, evidence, verification, and observability.
This article explores a practical architecture for building more reliable AI agents using AWS services.
Why LLM Responses Are Not Enough
Consider a user asking:
"Send an email to the project team confirming tomorrow's meeting."
A traditional LLM might generate:
"The email has been sent successfully."
But generating that sentence does not prove that an email was actually sent.
Several things could have gone wrong:
- The email API failed.
- Authentication expired.
- The recipient address was incorrect.
- The email was created but not sent.
- The model misunderstood the intended recipients.
- The external service returned an error.
This creates an important distinction:
1
AI Response ≠ Real-World ResultA reliable system must connect the model's reasoning to verifiable external actions.
A Better Architecture
Instead of allowing the LLM to directly control everything, we can introduce explicit layers.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
User
|
v
AI Agent / LLM
|
v
Planner
|
v
Tool Selection
|
v
Tool Execution
|
v
Evidence
|
v
Verification
|
v
Final ResponseEach layer has a specific responsibility.
LLM
Understands the user's request and reasons about what needs to happen.
Planner
Breaks a complex objective into executable steps.
Tool Layer
Performs actual operations against external systems.
Evidence Layer
Stores information proving what happened.
Verification Layer
Checks whether the result satisfies the original objective.
This separation dramatically improves reliability.
1. Treat Tools as Contracts
A tool should not simply be a function that the model can call arbitrarily.
It should have a well-defined contract.
For example:
1
2
3
4
5
6
7
8
9
{
"name": "send_email",
"description": "Send an email to one or more recipients",
"parameters": {
"recipient": "string",
"subject": "string",
"body": "string"
}
}The application can validate these parameters before executing the operation.
This creates a boundary between AI reasoning and application logic.
1
2
3
4
5
6
7
8
9
10
11
12
LLM
|
| "I want to send this email"
v
Tool Contract
|
| Validate parameters
v
Application
|
v
Email ProviderThe model decides what should happen.
The application decides whether and how it is allowed to happen.
2. Separate Read and Write Operations
Not all tools have the same risk.
Reading an email is fundamentally different from sending one.
A useful approach is to classify tools.
Read operations
Examples:
- Search emails
- Read documents
- Retrieve calendar events
- Query databases
Write operations
Examples:
- Send email
- Create calendar event
- Modify records
- Delete files
Write operations should generally receive stricter validation and authorization.
For example:
1
2
3
4
5
6
7
8
9
10
11
12
13
Read Tool
|
+--> Execute automatically
Write Tool
|
+--> Validate
|
+--> Check permissions
|
+--> Optional user approval
|
+--> ExecuteThis creates a practical safety boundary around autonomous behavior.
3. Add Human Approval for High-Impact Actions
Full autonomy sounds attractive, but some actions should remain under human control.
For example, an AI agent could automatically:
- Search documents
- Summarize emails
- Analyze data
- Find available meeting times
But actions such as:
- Sending an important external email
- Deleting data
- Making a purchase
- Modifying sensitive records
may require confirmation.
A simple approval architecture looks like this:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
Agent
|
v
Proposed Action
|
v
Risk Check
/ \
Low Risk High Risk
| |
v v
Execute Ask User
|
+----+----+
| |
Approve Reject
| |
v v
Execute StopThis provides a useful balance between automation and human control.
4. Store Evidence
One of the most powerful ideas for reliable agents is to treat evidence as a first-class object.
Suppose an agent searches for an invoice.
Instead of storing only:
1
"Invoice found."store structured evidence:
1
2
3
4
5
6
7
{
"tool": "search_documents",
"source": "s3://documents/invoices/",
"document_id": "invoice-2026-1042",
"timestamp": "2026-10-06T10:32:14Z",
"status": "success"
}Now the final answer can be connected to an actual source.
This also makes debugging significantly easier.
5. Verification Should Be Independent
A common mistake is asking the same reasoning process to both perform and verify an action.
Instead, verification should be treated as a separate stage.
For example:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
Original Objective:
"Schedule a meeting with the development team."
|
v
Planner
|
v
Calendar Tool
|
v
Event Created
|
v
Verification
|
+-----+-----+
| |
Verified Failed
| |
v v
Complete RetryThe verifier can check:
- Was the event actually created?
- Is the correct time used?
- Are the correct participants included?
- Does the result satisfy the original request?
This is much stronger than trusting the agent's own statement that the task succeeded.
6. Persistent State Matters
Agents performing multi-step tasks need memory of what has already happened during the mission.
For example:
1
2
3
4
5
6
7
8
9
10
11
Mission
|
+-- Step 1: Search emails ✓
|
+-- Step 2: Find document ✓
|
+-- Step 3: Analyze document ✓
|
+-- Step 4: Create summary Running
|
+-- Step 5: Verify PendingPersistent state allows the system to:
- Resume interrupted missions.
- Retry failed steps.
- Avoid repeating successful operations.
- Display progress to users.
- Investigate failures.
For AWS-based systems, services such as Amazon DynamoDB can be useful for storing mission state, while Amazon S3 can store larger artifacts.
7. AWS Architecture for Reliable Agents
A practical AWS architecture could look like this:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
User
|
v
Amazon API Gateway
|
v
Agent Application
|
+------------+------------+
| |
v v
Amazon Bedrock Mission State
Foundation Model Amazon DynamoDB
|
v
Planner
|
+------+------+
| |
v v
Tool A Tool B
| |
+------+------+
|
v
Evidence
|
v
Verification
|
v
Final ResultPossible AWS services include:
Amazon Bedrock
Provides access to foundation models for reasoning, planning, and generation.
AWS Lambda
Useful for short-lived, event-driven tool execution.
Amazon ECS / AWS Fargate
Useful for longer-running or containerized agent workloads.
Amazon DynamoDB
Can store mission state, task status, tool results, and execution metadata.
Amazon S3
Can store documents, generated artifacts, and large execution outputs.
Amazon API Gateway
Can expose APIs for the agent application.
AWS IAM
Provides identity and permission controls.
AWS Secrets Manager
Can securely store application secrets and credentials.
Amazon CloudWatch
Can provide logs, metrics, alarms, and operational visibility.
The exact architecture should be selected according to workload requirements rather than using every service by default.
8. Observability Is Essential
When a normal application fails, developers can usually inspect the request and response.
Agent systems are more complicated.
A single user request may result in:
1
2
3
4
5
6
7
8
9
10
11
1 Mission
|
+-- 1 Planner call
|
+-- 5 Tool calls
|
+-- 3 Model calls
|
+-- 2 Verification steps
|
+-- 1 Final responseWithout structured observability, understanding failures becomes extremely difficult.
Useful metrics include:
- Mission success rate
- Tool failure rate
- Average execution time
- Number of retries
- Verification failure rate
- Human approval rate
- Token usage
- Estimated execution cost
CloudWatch can provide a foundation for monitoring these signals in an AWS deployment.
9. Design for Failure
Autonomous agents should assume that failures will happen.
External APIs can fail.
Authentication can expire.
Network requests can time out.
Models can produce invalid tool parameters.
Therefore, the architecture should explicitly support failure recovery.
For example:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
Tool Call
|
v
Success? ---- No ----> Retry
| |
Yes v
| Retry Limit?
| |
| +-----+-----+
| | |
| No Yes
| | |
| +----> Escalate
|
v
VerificationRetries should be controlled rather than infinite.
For non-idempotent operations, the system should also prevent accidental duplicate execution.
10. The Principle of Least Privilege
Giving an AI agent access to everything is a serious security risk.
If an agent only needs to read objects from a specific S3 bucket, it should not receive permission to access every bucket in the AWS account.
Similarly, an agent responsible for reading calendar information should not automatically receive permission to modify every calendar.
The principle should be:
1
2
3
4
5
6
7
Required Permission
↓
Minimum Permission
↓
Specific Resource
↓
Specific ActionAWS IAM policies can help enforce these boundaries.
This becomes increasingly important as agents become capable of taking more actions.
11. Reliability Is a System Property
A common misconception is that a more powerful model automatically creates a more reliable agent.
It does not.
Model quality matters, but reliability depends on the entire system.
A useful mental model is:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
Agent Reliability
=
Model Quality
+
Tool Reliability
+
State Management
+
Permission Controls
+
Verification
+
Observability
+
Error RecoveryImproving only the prompt addresses just one part of the problem.
12. Practical Development Strategy
When building an AI agent, it is tempting to start with a complex multi-agent architecture.
A better approach is to begin with a small, observable workflow.
Step 1
Build one reliable tool.
Step 2
Add structured tool contracts.
Step 3
Add persistent execution state.
Step 4
Introduce planning.
Step 5
Add verification.
Step 6
Add approval for risky operations.
Step 7
Add observability and metrics.
Step 8
Only then introduce multiple specialized agents if the problem actually requires them.
This approach makes failures easier to understand and prevents unnecessary architectural complexity.
Conclusion
The most difficult part of building AI agents is not making them generate intelligent responses.
It is making them reliably interact with the real world.
A production-oriented agent needs more than an LLM. It needs explicit tools, permissions, persistent state, evidence, verification, failure recovery, and observability.
AWS provides building blocks for each of these layers, from Amazon Bedrock for foundation models to IAM, Lambda, DynamoDB, S3, and CloudWatch for the surrounding application infrastructure.
The key principle is:
Let the model reason, but let the system control, execute, and verify.
That separation is one of the foundations for building AI agents that users can actually trust.
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article