Exit interactive mode
mainTo exit the interactive development mode in the Agent Builder, you can use any of the following methods:
- Type
exit - Type
quit - Press
Ctrl+C - Press
Ctrl+D
exit
quitrepository·main·Indexed 19 days ago
https://github.com/strands-agents/agent-builderA model-driven toolkit for building, testing, and extending AI agents and tools via a terminal interface. It integrates with Amazon Bedrock for model execution and Knowledge Bases for tool and configuration persistence. The toolkit includes the `strands` CLI for interactive agent development, tool creation, and support for multiple model providers including Bedrock and Ollama.
To exit the interactive development mode in the Agent Builder, you can use any of the following methods:
exitquitCtrl+CCtrl+Dexit
quitStrands uses Amazon Bedrock Knowledge Bases to persist tools, configurations, and history.
Custom for Strands Agent.Amazon Titan Text Embeddings V2) and choose float32 or binary.aws bedrock-agent list-knowledge-bases.ABCDEFGHIJ).The strands command provides several ways to interact with the agent builder from your terminal:
strands to build a specialized agent.--kb flag to load and extend existing tools from an Amazon Bedrock Knowledge Base.# Run interactive mode for agent development
strands
# Build a custom tool and use it immediately
strands "Create a tool named sentiment_analyzer that analyzes text sentiment and test it with some examples"
# Pipe content to build an agent based on specifications
cat agent-spec.txt | strands "Build a specialized agent based on these specifications"
# Use with knowledge base to extend existing tools
strands --kb YOUR_KB_ID "Load my previous calculator tool and enhance it with scientific functions"Install the strands-agents-builder package using pipx to enable the strands CLI command.
# Install
pipx install strands-agents-builderYou can interact with your Knowledge Base using the --kb flag or by setting the STRANDS_KNOWLEDGE_BASE_ID environment variable.
Usage Examples:
# Load and extend tools from your knowledge base
strands --kb YOUR_KB_ID "Load my data_visualizer tool and add 3D plotting capabilities"
# Set a default knowledge base via environment variable
export STRANDS_KNOWLEDGE_BASE_ID="YOUR_KB_ID"
strands "Find my most recent agent configuration and make it more efficient"# Load and extend tools from your knowledge base
strands --kb YOUR_KB_ID "Load my data_visualizer tool and add 3D plotting capabilities"
# Or set a default knowledge base via environment variable
export STRANDS_KNOWLEDGE_BASE_ID="YOUR_KB_ID"
strands "Find my most recent agent configuration and make it more efficient"You can define the agent's persona and instructions using environment variables or a local file.
STRANDS_SYSTEM_PROMPT..prompt in your current directory.# Via environment variable
export STRANDS_SYSTEM_PROMPT="You are a Python expert."
# Or local file
echo "You are a security expert." > .promptThe CallbackHandler manages the visual state of the agent's execution through several phases:
init_event_loop is true, a blue 'retrieving memories...' spinner is shown. When start_event_loop is true, it updates to 'thinking...'.current_tool_use is detected, a ToolSpinner is created. It tracks the size of the input string to show progress (e.g., 🛠️ web_search: 45 chars).role: 'user' contains a toolResult, the handler calculates the duration of the tool execution and updates the spinner to a success (green) or failure (red) state.tool_histories and resets the current_spinner.You can connect an agent to a knowledge base to enable retrieval-augmented generation (RAG).
--kb flag or set the STRANDS_KNOWLEDGE_BASE_ID environment variable.agent.tool.retrieve using the user's input before processing the query.store_conversation_in_kb after each turn.# Using environment variable
export STRANDS_KNOWLEDGE_BASE_ID="my-kb-123"
strands "Search the docs for installation"Strands uses optimized defaults for Amazon Bedrock (Claude Sonnet 4). You can override these using environment variables.
STRANDS_MAX_TOKENS: Sets the maximum token output for responses (Default: 32767).STRANDS_BUDGET_TOKENS: Sets the budget for agent thinking/reasoning (Default: 2048).# Maximum tokens for responses
export STRANDS_MAX_TOKENS=32000
# Budget for agent thinking/reasoning
export STRANDS_BUDGET_TOKENS=1024You can switch from the default bedrock provider to ollama or a custom provider using the --model-provider and --model-config flags.
strands --model-provider ollama --model-config '{"model_id": "<ID>"}'To use a custom provider, create a Python module in $CWD/.models/ that exposes an instance function:
.models/custom_model.py:from mymodels import CustomModel
def instance(**config):
return CustomModel(**config)strands --model-provider custom_model --model-config <JSON|FILE># Example using Ollama
strands --model-provider ollama --model-config '{"model_id": "<ID>"}'Strands includes over 12 built-in tools for agentic workflows. Note that some tools like cron, python_repl, and shell are not available on Windows.
agent_graph: Manage graphs of agentscalculator: Mathematical operationscron: Task schedulingcurrent_time: Date and timeeditor: File editing (line edits, search, undo)environment: Manage environment variablesgenerate_image: AI image generation (Amazon Bedrock)http_request: API calls and web dataimage_reader: Image analysisjournal: Task and log managementload_tool: Dynamic runtime tool loadingmemory: Persistence via Amazon Bedrock Knowledge Basesnova_reels: AI video generation (Amazon Bedrock)python_repl: Python code executionretrieve: Semantic retrieval (Amazon Bedrock Knowledge Bases)shell: Shell command executionslack: Slack integrationspeak: Text-to-speech (macOS say or Amazon Polly)stop: Force stop the agent loopstore_in_kb: Save content to knowledge basesstrand: Create nested agent instancesswarm: Coordinate multiple agentsthink: Parallel agentic reasoning branchesuse_aws: AWS service interactionuse_llm: Run a new event loop with custom promptsworkflow: Orchestrate sequenced workflowsYou can customize the behavior of the Agent Builder using several environment variables. These allow you to control the model used, token limits, thinking capabilities, caching strategies, and system prompts without modifying code or configuration files.
| Environment Variable | Description | Default |
|----------------------|-------------|---------|
| STRANDS_MODEL_ID | Claude model ID to use for inference | us.anthropic.claude-sonnet-4-20250514-v1:0 |
| STRANDS_MAX_TOKENS | Maximum tokens for agent responses | 32768 |
| STRANDS_BUDGET_TOKENS | Token budget for agent thinking/reasoning | 2048 |
| STRANDS_THINKING_TYPE | Type of thinking capability | enabled |
| STRANDS_ANTHROPIC_BETA | Anthropic beta features (comma-separated) | interleaved-thinking-2025-05-14 |
| STRANDS_CACHE_TOOLS | Tool caching strategy | default |
| STRANDS_CACHE_PROMPT | Prompt caching strategy | default |
| STRANDS_SYSTEM_PROMPT | Custom system prompt (overrides .prompt file) | None |
| STRANDS_KNOWLEDGE_BASE_ID | Default Knowledge Base ID | None |
| STRANDS_TOOL_CONSOLE_MODE | Enable rich console UI | enabled |
| BYPASS_TOOL_CONSENT | Skip tool confirmation prompts | false |