AI代理开发正成为自动化复杂任务的关键,而繁琐的配置和高门槛常令人望而却步。
所幸有团队研发并开源了一款Python语言驱动的 AI Agents 开发框架:Strands Agents Tools,无缝帮助我们集成各种强大的功能。

提供30+预构建工具,支持文件操作、系统命令、HTTP请求、Python执行等功能,仅需几行代码即可构建强大的智能助手。
结合模型驱动的代理循环,支持从简单助手到多代理协作的复杂场景。
内置工具能力速览
-
• 30+ 高能工具集:涵盖文件系统、Shell 命令、HTTP、Python 执行等多种能力模块。 -
• 一行调用,开箱即用:工具封装为函数,轻松集成到任意 Agent 框架中。 -
• HTTP 客户端:发送 GET/POST 请求,支持自定义 headers、payload。 -
• Python 执行器:运行 Python 代码,带环境上下文保存、状态持久化。 -
• AWS 工具:与 S3、Lambda 等服务集成,轻松对接外部API。 -
• 多工具协作:支持任务拆分、工具组合、批量并行执行。 -
• 任务调度:提供任务生命周期管理器,便于构建复杂工作流。 -
• 内存管理:Agent 可拥有短期记忆、环境变量、上下文参数。
快速入手
最快的安装方式,即通过 pip 命令行安装(前提有Python环境)
pip install strands-agents-tools
如果要可选安装依赖项
pip install strands-agents-tools[mem0_memory, use_browser]
同时支持开发者源码安装
# Clone the repository
git clone https://github.com/strands-agents/tools.git
cd tools
# Create and activate virtual environment
python3 -m venv .venv
source .venv/bin/activate # On Windows: venv\Scripts\activate
# Install in development mode
pip install -e ".[dev]"
# Install pre-commit hooks
pre-commit install
使用示例(真的只需几行代码)
示例①:文件操作
from strands import Agent
from strands_tools import file_read, file_write, editor
agent = Agent(tools=[file_read, file_write, editor])
agent.tool.file_read(path="config.json")
agent.tool.file_write(path="output.txt", content="Hello, world!")
agent.tool.editor(command="view", path="script.py")
示例②:执行Shell命令
from strands import Agent
from strands_tools import shell
agent = Agent(tools=[shell])
# Execute a single command
result = agent.tool.shell(command="ls -la")
# Execute a sequence of commands
results = agent.tool.shell(command=["mkdir -p test_dir", "cd test_dir", "touch test.txt"])
# Execute commands with error handling
agent.tool.shell(command="risky-command", ignore_errors=True)
示例③:执行HTTP请求
from strands import Agent
from strands_tools import http_request
agent = Agent(tools=[http_request])
# Make a simple GET request
response = agent.tool.http_request(
method="GET",
url="https://api.example.com/data"
)
# POST request with authentication
response = agent.tool.http_request(
method="POST",
url="https://api.example.com/resource",
headers={"Content-Type": "application/json"},
body=json.dumps({"key": "value"}),
auth_type="Bearer",
auth_token="your_token_here"
)
示例④:Python代码执行
from strands import Agent
from strands_tools import python_repl
agent = Agent(tools=[python_repl])
# Execute Python code with state persistence
result = agent.tool.python_repl(code="""
import pandas as pd
# Load and process data
data = pd.read_csv('data.csv')
processed = data.groupby('category').mean()
processed.head()
""")
示例⑤:群体智能
from strands import Agent
from strands_tools import swarm
agent = Agent(tools=[swarm])
# Create a collaborative swarm of agents to tackle a complex problem
result = agent.tool.swarm(
task="Generate creative solutions for reducing plastic waste in urban areas",
swarm_size=5,
coordination_pattern="collaborative"
)
# Create a competitive swarm for diverse solution generation
result = agent.tool.swarm(
task="Design an innovative product for smart home automation",
swarm_size=3,
coordination_pattern="competitive"
)
# Hybrid approach combining collaboration and competition
result = agent.tool.swarm(
task="Develop marketing strategies for a new sustainable fashion brand",
swarm_size=4,
coordination_pattern="hybrid"
)
示例⑥:使用浏览器
from strands import Agent
from strands_tools import use_browser
agent = Agent(tools=[use_browser])
# Simple navigation
result = agent.tool.use_browser(action="navigate", url="https://example.com")
# Sequential actions for form filling
result = agent.tool.use_browser(actions=[
{"action": "navigate", "args": {"url": "https://example.com/login"}},
{"action": "type", "args": {"selector": "#username", "text": "user@example.com"}},
{"action": "click", "args": {"selector": "#submit"}}
])
# Web scraping with content extraction
result = agent.tool.use_browser(actions=[
{"action": "navigate", "args": {"url": "https://example.com/data"}},
{"action": "get_text", "args": {"selector": ".content"}},
{"action": "click", "args": {"selector": ".next-page"}},
{"action": "get_html", "args": {"selector": "main"}}
])
还有更多有趣、功能丰富的调用方式,可参考官方文档指南来应用到你实际的业务场景中。
文档指南:https://strandsagents.com/latest/
适用场景
-
• 企业自动化:S3/EC2管理,批量API调用,效率提升10倍。 -
• 开发助手:Python执行代码,生成/调试脚本。 -
• 自动化运维助手:让你的 LLM Agent 具备真实操作系统能力。 -
• 多工具协作工作流:构建以工具为核心的 AI 多智能体自动化系统。 -
• API 流程测试器:快速构建网络请求测试与数据校验流程。
写在最后
Strands Agents Tools 是一个轻量化的开源工具集,用于加速 AI Agent 的构建与部署。
它提供了涵盖系统操作、网络交互、Python 执行、任务编排等多个方向的原子级能力,你只需几行代码就能完成复杂操作。
在多智能体框架愈加成熟的今天,具备强执行力的 Agent 工具集才是生产力核心。Strands Agents Tools 不仅降低了开发门槛,还为复杂任务调度和系统调用提供了完整解决方案。
一行代码调用功能,内置 30+ 实用工具,轻松构建自定义 AI 助手、Agent 自动化系统或 AI 运维平台。
如果你正在开发 AI Agent,或是深度的Python开发者,务必收藏 & 尝试这款宝藏项目!
GitHub 项目地址:https://github.com/strands-agents/tools

● 一款改变你视频下载体验的神器:MediaGo
● 字节把 Coze 核心开源了!可视化工作流引擎 FlowGram 上线,AI 赋能可视化流程!
● 英伟达开源语音识别模型!0.6B 参数登顶 ASR 榜单,1 秒转录 60 分钟音频!
● 开发者的文档收割机来了!这个开源工具让你一小时干完一周的活!
● PDF文档解剖术!OCR神器+1,这个开源工具把复杂排版秒变结构化数据!

(文:开源星探)