A CLI reference implementation of a Strands agent
The Strands CLI is a reference implementation built on top of the Strands SDK. It provides a terminal-based interface for interacting with Strands agents, demonstrating how to make a fully interactive streaming application with the Strands SDK.
The Strands CLI is Open-Source and available strands-agents/agent-builder.
Prerequisites
Section titled âPrerequisitesâIn addition to the prerequisites listed for examples, this example requires the following:
- Python package installer (
pip) - pipx for isolated Python package installation
- Git
Standard Installation
Section titled âStandard InstallationâTo install the Strands CLI:
# Installpipx install strands-agents-builder
# Run Strands CLIstrandsManual Installation
Section titled âManual InstallationâIf you prefer to install manually:
# Clone repositorygit clone https://github.com/strands-agents/agent-builder /path/to/custom/location
# Create virtual environmentcd /path/to/custom/locationpython -m venv venv
# Activate virtual environmentsource venv/bin/activate
# Install dependenciespip install -e .
# Create symlinksudo ln -sf /path/to/custom/location/venv/bin/strands /usr/local/bin/strandsCLI Verification
Section titled âCLI VerificationâTo verify your CLI installation:
# Run Strands CLI with a simple querystrands "Hello, Strands!"Command Line Arguments
Section titled âCommand Line Argumentsâ| Argument | Description | Example |
|---|---|---|
query | Question or command for Strands | strands "What's the current time?" |
--kb, --knowledge-base | KNOWLEDGE_BASE_ID | Knowledge base ID to use for retrievals |
--model-provider | MODEL_PROVIDER | Model provider to use for inference |
--model-config | MODEL_CONFIG | Model config as JSON string or path |
Interactive Mode Commands
Section titled âInteractive Mode CommandsâWhen running Strands in interactive mode, you can use these special commands:
| Command | Description |
|---|---|
exit | Exit Strands CLI |
!command | Execute shell command directly |
Shell Integration
Section titled âShell IntegrationâStrands CLI integrates with your shell in several ways:
Direct Shell Commands
Section titled âDirect Shell CommandsâExecute shell commands directly by prefixing with !:
> !ls -la> !git status> !docker psNatural Language Shell Commands
Section titled âNatural Language Shell CommandsâAsk Strands to run shell commands using natural language:
> Show me all running processes> Create a new directory called "project" and initialize a git repository there> Find all Python files modified in the last weekEnvironment Variables
Section titled âEnvironment VariablesâStrands CLI respects these environment variables for basic configuration:
| Variable | Description | Default |
|---|---|---|
STRANDS_SYSTEM_PROMPT | System instructions for the agent | You are a helpful agent. |
STRANDS_KNOWLEDGE_BASE_ID | Knowledge base for memory integration | None |
Example:
export STRANDS_KNOWLEDGE_BASE_ID="YOUR_KB_ID"strands "What were our key decisions last week?"Command Line Arguments
Section titled âCommand Line ArgumentsâCommand line arguments override any configuration from files or environment variables:
# Enable memory with knowledge basestrands --kb your-kb-idCustom Model Provider
Section titled âCustom Model ProviderâYou can configure strands to use a different model provider with specific settings by passing in the following arguments:
strands --model-provider <NAME> --model-config <JSON|FILE>As an example, if you wanted to use the packaged Ollama provider with a specific model id, you would run:
strands --model-provider ollama --model-config '{"model_id": "llama3.3"}'Strands is packaged with bedrock and ollama as providers.