Build and run Python-based AI agents using the AWS Strands SDK. Use when you need to create autonomous agents, multi-agent workflows, custom tools, or integrate with MCP servers. Supports Ollama (local), Anthropic, OpenAI, Bedrock, and other model providers. Use for agent scaffolding, tool creation, and running agent tasks programmatically.
数据来源:ClawHub。 在 ClawSkills 查看
选择你使用的 Agent
方法一:命令行安装(推荐)
推荐(无需提前安装 clawhub)
npx clawhub@latest --dir ~/.claude/skills install aws-strands或使用 clawhub CLI(需提前安装)
clawhub --dir ~/.claude/skills install aws-strands⚠️ 需要 Node.js 18+,没有 Node?请使用下方方法二直接下载 ZIP。 安装 Node.js →
方法二:手动下载安装(无需 Node)
下载 ZIP,解压后将文件夹放到以下路径,重启 Agent 即可:
安装路径
~/.claude/skills/aws-strands/💡解压后将文件夹放到上方路径,重启 Agent 即可生效
--- name: strands version: 2.0.0 description: Build and run Python-based AI agents using the AWS Strands SDK. Use when you need to create autonomous agents, multi-agent workflows, custom tools, or integrate with MCP servers. Supports Ollama (local), Anthropic, OpenAI, Bedrock, and other model providers. Use for agent scaffolding, tool creation, and running agent tasks programmatically. homepage: https://github.com/strands-agents/sdk-python metadata: openclaw: emoji: 🧬 requires: bins: [python3] packages: [strands-agents] ---
Build AI agents in Python using the Strands SDK (Apache-2.0, from AWS).
Validated against: strands-agents==1.23.0, strands-agents-tools==0.2.19
# Install SDK + tools (via pipx for isolation — recommended)
pipx install strands-agents-builder # includes strands-agents + strands-agents-tools + CLI
# Or install directly
pip install strands-agents strands-agents-tools
Agent() with no model= argument defaults to Amazon Bedrock — specifically us.anthropic.claude-sonnet-4-20250514-v1:0 in us-west-2. This requires AWS credentials. To use a different provider, pass model= explicitly.
Default model constant: strands.models.bedrock.DEFAULT_BEDROCK_MODEL_ID
from strands import Agent
from strands.models.ollama import OllamaModel
# host is a required positional argument
model = OllamaModel("http://localhost:11434", model_id="qwen3:latest")
agent = Agent(model=model)
result = agent("What is the capital of France?")
print(result)
Note: Not all open-source models support tool-calling. Abliterated models often lose function-calling during the abliteration process. Test with a stock model (qwen3, llama3.x, mistral) first.
from strands import Agent
# No model specified → BedrockModel (Claude Sonnet 4, us-west-2)
# Requires AWS credentials (~/.aws/credentials or env vars)
agent = Agent()
result = agent("Explain quantum computing")
# Explicit Bedrock model:
from strands.models import BedrockModel
model = BedrockModel(model_id="us.anthropic.claude-sonnet-4-20250514-v1:0")
agent = Agent(model=model)
from strands import Agent
from strands.models.anthropic import AnthropicModel
# max_tokens is Required[int] — must be provided
model = AnthropicModel(model_id="claude-sonnet-4-20250514", max_tokens=4096)
agent = Agent(model=model)
result = agent("Explain quantum computing")
Requires ANTHROPIC_API_KEY environment variable.
from strands import Agent
from strands.models.openai import OpenAIModel
model = OpenAIModel(model_id="gpt-4.1")
agent = Agent(model=model)
Requires OPENAI_API_KEY environment variable.
Use the @tool decorator. Type hints become the schema; the docstring becomes the description:
from strands import Agent, tool
@tool
def read_file(path: str) -> str:
"""Read contents of a file at the given path.
Args:
path: Filesystem path to read.
"""
with open(path) as f:
return f.read()
@tool
def write_file(path: str, content: str) -> str:
"""Write content to a file.
Args:
path: Filesystem path to write.
content: Text content to write.
"""
with open(path, 'w') as f:
f.write(content)
return f"Wrote {len(content)} bytes to {path}"
agent = Agent(model=model, tools=[read_file, write_file])
agent("Read /tmp/test.txt and summarize it")
Tools can access agent state via ToolContext:
from strands import tool
from strands.types.tools import ToolContext
@tool
def stateful_tool(query: str, tool_context: ToolContext) -> str:
"""A tool that accesses agent state.
Args:
query: Input query.
"""
# Access shared agent state
count = tool_context.state.get("call_count", 0) + 1
tool_context.state["call_count"] = count
return f"Call #{count}: {query}"
strands-agents-tools provides pre-built tools:
from strands_tools import calculator, file_read, file_write, shell, http_request
agent = Agent(model=model, tools=[calculator, file_read, shell])
Full list: calculator, file_read, file_write, shell, http_request, editor, image_reader, python_repl, current_time, think, stop, sleep, environment, retrieve, search_video, chat_video, speak, generate_image, generate_image_stability, diagram, journal, memory, agent_core_memory, elasticsearch_memory, mongodb_memory, mem0_memory, rss, cron, batch, workflow, use_agent, use_llm, use_aws, use_computer, load_tool, handoff_to_user, slack, swarm, graph, a2a_client, mcp_client, exa, tavily, bright_data, nova_reels.
Hot reload: Agent(load_tools_from_directory=True) watches ./tools/ for changes.
Connect to any Model Context Protocol server. MCPClient implements ToolProvider — pass it directly in the tools list:
from strands import Agent
from strands.tools.mcp import MCPClient
from mcp import stdio_client, StdioServerParameters
# MCPClient takes a callable that returns the transport
mcp = MCPClient(lambda: stdio_client(StdioServerParameters(
command="uvx",
args=["some-mcp-server@latest"]
)))
# Use as context manager — MCPClient is a ToolProvider
with mcp:
agent = Agent(model=model, tools=[mcp])
agent("Use the MCP tools to do something")
SSE transport:
from mcp.client.sse import sse_client
mcp = MCPClient(lambda: sse_client("http://localhost:8080/sse"))
Nest agents — inner agents become tools for the outer agent:
researcher = Agent(model=model, system_prompt="You are a research assistant.")
writer = Agent(model=model, system_prompt="You are a writer.")
orchestrator = Agent(
model=model,
tools=[researcher, writer],
system_prompt="You coordinate research and writing tasks."
)
orchestrator("Research quantum computing and write a blog post")
Self-organizing agent teams with shared context and autonomous handoff coordination:
from strands.multiagent.swarm import Swarm
# Agents need name + description for handoff identification
researcher = Agent(
model=model,
name="researcher",
description="Finds and summarizes information"
)
writer = Agent(
model=model,
name="writer",
description="Creates polished content"
)
swarm = Swarm(
nodes=[researcher, writer],
entry_point=researcher, # optional — defaults to first agent
max_handoffs=20, # default
max_iterations=20, # default
execution_timeout=900.0, # 15 min default
node_timeout=300.0 # 5 min per node default
)
result = swarm("Research AI agents, then hand off to writer for a blog post")
Swarm auto-injects a handoff_to_agent tool. Agents hand off by calling it with the target agent's name. Supports interrupt/resume, session persistence, and repetitive-handoff detection.
Deterministic dependency-based execution via GraphBuilder:
from strands.multiagent.graph import GraphBuilder
builder = GraphBuilder()
research_node = builder.add_node(researcher, node_id="research")
writing_node = builder.add_node(writer, node_id="writing")
builder.add_edge("research", "writing")
builder.set_entry_point("research")
# Optional: conditional edges
# builder.add_edge("research", "writing",
# condition=lambda state: "complete" in str(state.completed_nodes))
graph = builder.build()
result = graph("Write a blog post about AI agents")
...
安装 Strands 后,可以对 AI 说这些话来触发它
Help me get started with Strands
Explains what Strands does, walks through the setup, and runs a quick demo based on your current project
Use Strands to build and run Python-based AI agents using the AWS Strands SDK
Invokes Strands with the right parameters and returns the result directly in the conversation
What can I do with Strands in my developer & devops workflow?
Lists the top use cases for Strands, with example commands for each scenario
将技能文件夹放到 ~/.claude/skills/aws-strands/ 目录(个人级,所有项目可用),或 .claude/skills/aws-strands/(项目级)。重启 AI 客户端后,用 /aws-strands 主动调用,或让 AI 根据上下文自动发现并使用。
Strands 支持 Claude、Cursor、OpenClaw,可与这些 AI 平台无缝集成,扩展其能力。
Strands 可免费安装使用。请查阅仓库了解许可证信息。
Build and run Python-based AI agents using the AWS Strands SDK. Use when you need to create autonomous agents, multi-agent workflows, custom tools, or integrate with MCP servers. Supports Ollama (local), Anthropic, OpenAI, Bedrock, and other model providers. Use for agent scaffolding, tool creation, and running agent tasks programmatically.
Strands 属于「Developer & DevOps」分类,该分类的技能帮助 AI 智能体在此领域执行专业任务。
Automate my developer & devops tasks using Strands
Identifies repetitive steps in your workflow and sets up Strands to handle them automatically