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 agent core
Section titled “The agent core”State it carries
Section titled “State it carries”Control at runtime
Section titled “Control at runtime”A composed agent
Section titled “A composed agent”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
@tooldef 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?")import { Agent, tool } from '@strands-agents/sdk'import { z } from 'zod'
const wordCount = tool({ name: 'word_count', description: 'Count the words in a piece of text.', inputSchema: z.object({ text: z.string() }), callback: (input) => `${input.text.split(/\s+/).length} words`,})
const agent = new Agent({ systemPrompt: 'You are a concise writing assistant.', tools: [wordCount],})await agent.invoke('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.
Where to go next
Section titled “Where to go next”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.