Skip to content

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.

In addition to the prerequisites listed for examples, this example requires the following:

  • Python package installer (pip)
  • pipx for isolated Python package installation
  • Git

To install the Strands CLI:

Terminal window
# Install
pipx install strands-agents-builder
# Run Strands CLI
strands

If you prefer to install manually:

Terminal window
# Clone repository
git clone https://github.com/strands-agents/agent-builder /path/to/custom/location
# Create virtual environment
cd /path/to/custom/location
python -m venv venv
# Activate virtual environment
source venv/bin/activate
# Install dependencies
pip install -e .
# Create symlink
sudo ln -sf /path/to/custom/location/venv/bin/strands /usr/local/bin/strands

To verify your CLI installation:

Terminal window
# Run Strands CLI with a simple query
strands "Hello, Strands!"
ArgumentDescriptionExample
queryQuestion or command for Strandsstrands "What's the current time?"
--kb, --knowledge-baseKNOWLEDGE_BASE_IDKnowledge base ID to use for retrievals
--model-providerMODEL_PROVIDERModel provider to use for inference
--model-configMODEL_CONFIGModel config as JSON string or path

When running Strands in interactive mode, you can use these special commands:

CommandDescription
exitExit Strands CLI
!commandExecute shell command directly

Strands CLI integrates with your shell in several ways:

Execute shell commands directly by prefixing with !:

Terminal window
> !ls -la
> !git status
> !docker ps

Ask Strands to run shell commands using natural language:

Terminal window
> 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 week

Strands CLI respects these environment variables for basic configuration:

VariableDescriptionDefault
STRANDS_SYSTEM_PROMPTSystem instructions for the agentYou are a helpful agent.
STRANDS_KNOWLEDGE_BASE_IDKnowledge base for memory integrationNone

Example:

Terminal window
export STRANDS_KNOWLEDGE_BASE_ID="YOUR_KB_ID"
strands "What were our key decisions last week?"

Command line arguments override any configuration from files or environment variables:

Terminal window
# Enable memory with knowledge base
strands --kb your-kb-id

You can configure strands to use a different model provider with specific settings by passing in the following arguments:

Terminal window
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:

Terminal window
strands --model-provider ollama --model-config '{"model_id": "llama3.3"}'

Strands is packaged with bedrock and ollama as providers.