
Understanding agents and agentic applications
Learn more about the agent loop and create a simple agent using Strands Agents.
Note: This article is part of a series on creating agentic applications with Amazon Bedrock and Strands Agents. Please check out the series overview for the list of related articles and guidance on setting up your development environment.
What is an agent?
Let's start with a definition from AWS:
An artificial intelligence (AI) agent is a software program that can interact with its environment, collect data, and use that data to perform self-directed tasks that meet predetermined goals.
Simon Willison also offers this concise definition:
An LLM agent runs tools in a loop to achieve a goal.
What is the meaning of "tool" in this case? A tool allows a large language model to tell the calling application to invoke a function with parameters supplied by the model.
Bringing the two definitions together, tools are the primary mechanism for an agent to interact with its environment and collect data. The agent loop is where the self-directed tasks are chosen that align with the goals.
The agent loop
The agent loop is the iterative process through which an agent achieves a goal. This process is illustrated in the diagram below:

The agent loop process is as follows:
- A prompt and context are sent to an LLM. The context includes tools, a system prompt, and past messages.
- Based on the input, the LLM determines if it should:
- Request tool use to achieve the goal
- Request more information (ends the agent loop for now)
- Return a final result (ends the agent loop for now)
- The application executes the requested tools, and sends the tool results to the LLM along with the context.
GOTO 2
This process can iterate multiple times as the agent progresses towards its goal. It may need to exit the loop to get user input or clarification, or exit due to an error.
A simple example agent
Let's create a simple agent that demonstrates running tools in a loop. We'll use the Strands Agents SDK with Python.
This example creates an agent with three math tools (sine, cosine, and divide) and a hard-coded prompt. No best practices, but good enough to get started:
Here is the code for simple.py. It requires the strands-agents package to be installed, and AWS access:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
"""A simple agent demo"""
import math
from strands import Agent, tool
def cosine(x: float) -> float:
return math.cos(x)
def sine(x: float) -> float:
return math.sin(x)
def divide(x: float, y: float) -> float:
return x / y
agent = Agent(tools=[cosine, sine, divide])
agent("What is the tangent of 8.12515? Provide accuracy to 5 places.")
Then we can run it from the command line:
1
python simple.pyWith output that looks something like this:
1
2
3
4
5
6
7
8
I can calculate the tangent of 8.12515 using the relationship tan(x) = sin(x) / cos(x).
Let me compute both the sine and cosine of this value first.
Tool #1: sine
Tool #2: cosine
Now I'll divide sine by cosine to get the tangent:
Tool #3: divide
The tangent of 8.12515 is **-3.59691** (accurate to 5 decimal places).What just happened?
We asked the agent to calculate a tangent, but didn't give it a
tangent tool. So it had to figure out another way to achieve its task (the trigonometric identity tan(x) = sin(x) / cos(x)). In this case, it did the work in two steps:- Calculate the sine and cosine values for
x. These were invoked at the same time, since they have no dependency on each other. - Divide the sine value by the cosine value. This was invoked once the previous values were calculated.
Mapping this example to the definitions of agent
Recall the first definition from earlier:
An artificial intelligence (AI) agent is a software program that can interact with its environment, collect data, and use that data to perform self-directed tasks that meet predetermined goals.
- a software program: the
Agentobject instance - that can interact with its environment: the
cosine,sine, anddividetools - collect data: the results from the
sine,cosine, anddividetool calls - and use that data to perform self-directed tasks: calculating the trigonometric identity for tangent
- that meet predetermined goals: calculating the tangent of 8.12515
Or the second definition:
An LLM agent runs tools in a loop to achieve a goal.
- An LLM agent: the
Agentobject instance - runs tools: the array of tools passed to the Agent() constructor
- in a loop: kicked off by invoking
agent() - to achieve a goal: calculating the tangent of 8.12515
Throughout this series, we'll expand on the use of tools and agent loops to achieve a wide variety of goals.
What are agentic applications?
For the purpose of this series, we will be focusing on the building of "agentic applications".
Agentic applications combine deterministic (code-powered) and non-deterministic (AI-powered) components to solve problems that could not be solved by deterministic processes alone.
There is a spectrum of agentic applications, from almost entirely deterministic (workflows and applications with generative AI functions in isolation), to almost entirely non-deterministic (AI agents solving advanced problems as they see fit).
Much value will be found somewhere in between, with a combination of fast & cheap deterministic processes mixed with comparatively slow & expensive AI-powered processes. By "fast/slow" and "cheap/expensive", we are referring to run-time compute. In emerging use cases, solutions that tilt towards the AI-powered side may end up being less expensive overall due to the reduced development time and code complexity needed to solve more open-ended problems.
You will likely have experience building deterministic systems. The good news is that with the advent of LLMs and agentic frameworks like Strands Agents, we can interact with AI using the same API-based approaches that we have been using for years. Most of us know how to speak "API". So the real learning curve will be in how to speak "LLM". For our purposes that means:
- Context engineering - effectively curating the combined inputs to an LLM to efficiently get the desired outcome
- Prompt engineering - (really a sub-discipline of context engineering) - communicating intent and objectives effectively to an LLM (the "wordsmithing" aspects)
- Tool definitions - (really a sub-discipline of prompt engineering) - defining API signatures to help bridge the gap between non-deterministic and deterministic processes
Additionally, we will also discuss systems-related topics like session management, Model Context Protocol (MCP), and observability. These are critical for scaling agentic applications effectively.
That's it! We'll get more into the details of these interactions in the following section on messages and content blocks .
Learn more
Please check out the series overview for more articles on agentic topics.
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article