
How-Tos
How to run a first Strands agent
Install Strands, run a first Bedrock-backed agent, and add one custom tool plus the vended file editor.
Searcher → Analyst → Writer → Editor · subagentic-20261028-0800
The Strands Python quickstart is a complete first run: install the SDK, start an agent, then hand it a tool. Everything past that — streaming, memory, observability, deployment — has its own guide. This article follows the documented default, Amazon Bedrock, from install through the documented tool step. Other providers stay in the quickstart's tabs, where the snippets already live.
Install the SDK
Confirm Python 3.10 or newer, and activate a virtual environment before you install. The quickstart does not print the virtual-environment commands. It points to the Python documentation if you still need to create one. With that environment active, install the Strands Harness SDK:
pip install strands-agents
That single package is enough for the default provider. Provider-specific extras, such as the Anthropic install pip install 'strands-agents[anthropic]', appear on the other tabs. Do not add one of those extras unless you are leaving Bedrock.
Run the default Bedrock agent
Strands works with any major model provider. The model is one object you hand to the agent, and the rest of the code does not change with the provider. The quickstart puts the common providers in tabs: Amazon Bedrock, Anthropic, OpenAI, Google, and Ollama.
Amazon Bedrock is the default, using Claude Sonnet 4.6 in the us-west-2 region, so the first file needs no extra install and no model object. Create agent.py with the Bedrock snippet:
from strands import Agent
# Bedrock is the default, so no model object is needed.
agent = Agent()
agent("What is an agent harness, in one sentence?")
That assignment is the whole constructor. The quickstart comment says no model object is needed. The string on the next line is the request.
The SDK still needs AWS credentials with permission to invoke the model. The quickstart documents three options:
- A Bedrock API key in the
AWS_BEARER_TOKEN_BEDROCKenvironment variable. The page calls this the quickest option for local development. - Standard AWS credentials, from
aws configure, or from theAWS_ACCESS_KEY_ID,AWS_SECRET_ACCESS_KEY, and optionallyAWS_SESSION_TOKENenvironment variables. - An IAM role, on AWS services such as EC2, ECS, or Lambda.
Credentials are not the last gate. Enable access to the models you use in the Amazon Bedrock console. The quickstart points to the AWS documentation for that step and does not list the console clicks, so treat model access as a required check before you blame the Python file.
Run the file with the command from the quickstart:
python -u agent.py
The agent streams its response to the console. To silence that stream, pass callback_handler=None to Agent. The first snippet does not; add it only if you want a quiet console.
If Bedrock is not the provider you already have access to, open the matching tab on the quickstart instead of guessing a model id or an install extra. The same page also names LiteLLM, Mistral, SageMaker, Llama API, llama.cpp, Writer, OpenAI-compatible endpoints, and a custom provider you write, and it links to the model-providers guide. Use that page for those setups. This walkthrough does not reconstruct them.
Add a custom tool and the vended file editor
You now have an agent loop, and nothing for it to act with. It can only answer from what the model already knows. A tool is a function the model can decide to call. Tools come from two places: vended tools that ship with the SDK, for jobs such as editing files, running shell commands, and making HTTP requests, and any Python function you mark with @tool. The quickstart uses one of each.
The docstring and the type hints are what the model reads when it decides whether to call the tool and what to pass. Add this at the top of agent.py. It imports the vended file_editor and defines letter_counter:
from strands import Agent, tool
from strands.vended_tools import file_editor
@tool
def letter_counter(word: str, letter: str) -> int:
"""
Count occurrences of a specific letter in a word.
Args:
word (str): The input word to search in
letter (str): The specific letter to count
Returns:
int: The number of occurrences of the letter in the word
"""
if len(letter) != 1:
raise ValueError("The 'letter' parameter must be a single character")
return word.lower().count(letter.lower())
Then replace the agent creation. On the Bedrock path there is still no model object. Both tools go in the tools list, and the prompt needs each of them: a letter count, then a file write.
agent = Agent(tools=[letter_counter, file_editor])
agent('How many letter R\'s are in the word "strawberry"? Write the answer to answer.txt.')
If you set a model from another provider tab, keep your model line, as the quickstart says. Those tabs pass that model object in with the same tools list. The Bedrock tab leaves the model argument out because Bedrock is already the default.
Run the same command again:
python -u agent.py
The model works out that counting letters is what letter_counter is for and that writing a file is what file_editor is for, calls both, and leaves answer.txt in the working directory. You wrote one of those tools. The other came with the SDK. The quickstart does not show what answer.txt contains, so confirm the file was created rather than matching it against a number the docs never publish.
What the loop just did
The agent decides when to call a tool based on the request, loops until it has an answer, and streams the response to the console. Every pass adds to the conversation history. Every invocation returns an AgentResult carrying the run's messages, metrics, and traces, so you can see which tools were called and why. The quickstart points to the Agent Loop guide for that cycle and to Observability for reading the traces and metrics.
What to run next
Run the tool-enabled agent.py and confirm answer.txt showed up in the working directory. Then stay on the quickstart and use its Next Steps list: vended tools, if you want file editing, shell, and HTTP ready to drop into tools; the Agent Loop page, if you want the cycle under the hood; and the model-providers guide, if you are leaving the Bedrock default. The same page documents an optional MCP server for coding assistants. It is not required to run an agent, it requires uv, and the quickstart tells a coding assistant to ask before installing it.