◈ AWS AGENTCORE BLUEPRINTS
PART I · FOUNDATIONS · CHAPTER 05 / 36
TOCCONSULTING.FR
AMAZON BEDROCK / SERVICE DETAIL S01 HARNESS

HARNESS, THE STRANDS PATHPRACTICAL 1 / 2

CHAPTER 05 / 36
TOPIC build and run the loop yourself
REV 2026.07
New to these words? Sheet 01-A "Key terms" defines agent, tool, the loop, model, and session.
IN PLAIN WORDS

You will install the Strands library, write a tiny agent in one file, and run it on your own machine to watch the loop work. Terms used here: pip = the Python package installer; @tool = a small tag that turns a normal function into something the agent can call; model provider = where the AI model runs (here Amazon Bedrock, which hosts Claude).

[ 1 ] INSTALL AND SET UP
$ pip install strands-agents strands-agents-tools $ aws configure # set credentials and region $ aws sts get-caller-identity # confirm credentials work
[x] Python 3.10+
[x] AWS credentials configured
[x] Bedrock model access (Claude)
[x] Strands defaults to Amazon Bedrock
[ 2 ] WRITE THE AGENT (my_agent.py)
# my_agent.py
from strands import Agent, tool

@tool
def word_count(text: str) -> int:
    """Count the words in a piece of text."""  # the docstring
    return len(text.split())                # tells the model

agent = Agent(tools=[word_count])         # default model: Bedrock (Claude)
result = agent("How many words are in: the quick brown fox")
print(result)
WHAT EACH PART DOES
@tool turns a plain function into a tool the model can choose. The docstring and the type hints are the contract the model reads.
Agent(...) binds a model and the tools. Add system_prompt= for instructions.
agent("...") sends the input and runs the whole loop until a final answer.
[ 3 ] RUN IT
$ python my_agent.py There are 4 words in "the quick brown fox".
[ 4 ] THE LOOP, MAPPED TO THIS CODE (see theory chapter 04 for L01 to L06)
L01 INPUT. You call agent("How many words ...").
L02 MODEL REASONS. The model reads the prompt plus the word_count tool spec, and decides to use a tool.
L03 TOOL CALL. It requests word_count(text="the quick brown fox").
L04 EXECUTE. Your function runs and returns 4.
L05 RESULT. The value goes back to the model.
L06 FINAL. No more tools needed, so the model writes the answer. The loop ends.
[ 5 ] GROW IT
+ Add more @tool functions. The model picks the right one per turn.
+ Intercept tools with hooks: BeforeToolCallEvent, AfterToolCallEvent.
+ Swap model providers (Bedrock, Anthropic, others) without changing the agent code.
+ Connect tools from AgentCore Gateway and MCP servers over MCP.
When you are ready to run this in the cloud without managing the loop or infrastructure, use the managed Harness. See practical chapter 04.
SRC: strandsagents.com, awslabs agentcore samples (package names), AgentCore Developer Guide
DRAWN 2026.06, REV 2026.07.26
◄ PREVIOUS · CH 04
Inside an AgentCore Agent, Blueprint
NEXT · CH 06 ►
Harness, Practical 2, Managed Harness
AWS AGENTCORE BLUEPRINTS · CONTENTS
Back to tocconsulting.fr Cover & Table of Contents
PART I · FOUNDATIONS
01AgentCore Overview, Plain LanguageCONCEPT02AgentCore, Key Terms in Plain LanguageCONCEPT03AgentCore, Common Mistakes ExplainedCONCEPT04Inside an AgentCore Agent, BlueprintCONCEPT05Harness, Practical 1, Strands PathPRACTICAL06Harness, Practical 2, Managed HarnessPRACTICAL
PART II · CORE SERVICES
07AgentCore Runtime, Plain LanguageCONCEPT08AgentCore Runtime, PracticalPRACTICAL09AgentCore Memory, Plain LanguageCONCEPT10AgentCore Memory, PracticalPRACTICAL11AgentCore Gateway, Plain LanguageCONCEPT12AgentCore Gateway, PracticalPRACTICAL13AgentCore Identity, Plain LanguageCONCEPT14AgentCore Identity, PracticalPRACTICAL
PART III · TOOLS AND OPERATIONS
15AgentCore Code Interpreter, Plain LanguageCONCEPT16AgentCore Code Interpreter, PracticalPRACTICAL17AgentCore Browser, Plain LanguageCONCEPT18AgentCore Browser, PracticalPRACTICAL19AgentCore Observability, Plain LanguageCONCEPT20AgentCore Observability, PracticalPRACTICAL21AgentCore Evaluations, Plain LanguageCONCEPT22AgentCore Evaluations, PracticalPRACTICAL
PART IV · GOVERNANCE AND TRANSACTIONS
23AgentCore Policy, Plain LanguageCONCEPT24AgentCore Policy, PracticalPRACTICAL25AgentCore Registry, Plain LanguageCONCEPT26AgentCore Registry, PracticalPRACTICAL27AgentCore Payments, Plain LanguageCONCEPT28AgentCore Payments, PracticalPRACTICAL
PART V · MULTI-AGENT AND ARCHITECTURE
29A2A and Multi-Agent, Plain LanguageCONCEPT30A2A and Multi-Agent, PracticalPRACTICAL31Architecture Patterns, Plain LanguageCONCEPT32Multi-Tenant Agents, Plain LanguageCONCEPT33Agent Security and Threat Model, Plain LanguageCONCEPT34Governance at Org Scale, Plain LanguageCONCEPT35Governance at Org Scale, PracticalPRACTICAL36Multi-Region and Distribution, Plain LanguageCONCEPT