Skip to content

Anatomy of an agent

An agent in Strands is a model wrapped in a loop that reasons, calls your tools, and works toward a goal across as many turns as the task needs. You build one by composing a few parts on that loop: the prompts that shape how it behaves, the state it carries between turns, the tools it can reach for, and the hooks and interventions that let you control it while it runs. Each part is its own page in this section; this is the map of how they fit together.

The smallest agent that shows the composition: a model with a system prompt, a tool it can call, and the loop that decides when to use it.

from strands import Agent, tool
@tool
def word_count(text: str) -> str:
"""Count the words in a piece of text."""
return f"{len(text.split())} words"
agent = Agent(
system_prompt="You are a concise writing assistant.",
tools=[word_count],
)
agent("How many words are in this sentence?")

The loop, the prompt, and the tool are the whole agent here. Every other part in this section adds to that same core rather than replacing it.

New to the SDK? Start with the Python quickstart or TypeScript quickstart, then read the agent loop to understand the cycle everything else builds on.

Building a feature? Give the agent capabilities with tools, then reach for the part of the anatomy your task needs: session management to persist a conversation, hooks to run code at each step, or interventions to keep a human or a policy in the loop.