Strands智能体开发Strands智能体开发
Strands智能体开发

技能简介

Strands是AWS开源的Python SDK,用于构建和运行AI智能体。支持Ollama本地模型、Anthropic、OpenAI、Bedrock等多种提供商,提供46种内置工具与自定义工具扩展能力。

能做什么

  • 创建单智能体或多智能体协作工作流
  • 通过装饰器快速开发自定义工具
  • 集成MCP服务器扩展能力边界
  • 使用预置工具完成文件操作、网络请求、代码执行等任务
  • 在本地环境或云端Bedrock上运行智能体

使用说明

安装SDK(推荐隔离安装):

pipx install strands-agents-builder

或直接安装:

pip install strands-agents strands-agents-tools

本地Ollama运行示例:

from strands import Agent
from strands.models.ollama import OllamaModel

model = OllamaModel("http://localhost:11434", model_id="qwen3:latest")
agent = Agent(model=model)
result = agent("What is the capital of France?")

AWS Bedrock默认运行(无需指定模型):

from strands import Agent
agent = Agent()  # 默认使用us-west-2的Claude Sonnet 4
result = agent("Explain quantum computing")

自定义工具开发:

from strands import Agent, tool

@tool
def read_file(path: str) -> str:
    """Read contents of a file."""
    with open(path) as f:
        return f.read()

agent = Agent(model=model, tools=[read_file])

输入与输出

见下方输入与输出表格。

项目内容
输入自然语言指令;可选模型配置(Ollama/Bedrock/Anthropic/OpenAI);自定义工具函数;MCP服务器连接信息
输出智能体响应文本;工具执行结果;状态更新数据
适用人群Python开发者、自动化工程师、多智能体系统研究者、需要本地部署的企业用户
不包含图形化开发界面、模型训练能力、商业托管服务、JavaScript/Go等其他语言SDK

 

风险提示

  • 未指定模型时默认调用AWS Bedrock,需配置有效AWS凭证
  • Ollama本地模型需自行验证工具调用能力,部分修改版模型可能丢失函数调用功能
  • Anthropic/OpenAI接口需配置对应API密钥环境变量
  • shell、file_write等工具存在本地系统操作风险,生产环境需谨慎授权

来源信息

原始链接:https://github.com/openclaw/skills/tree/main/skills/trippingkelsea/strands/SKILL.md
来源类型:GitHub仓库

数据统计

相关导航

暂无评论

none
暂无评论...