strands-agents/samples
GitHub: strands-agents/samples
Strands Agents SDK 官方示例代码库,提供从入门教程到生产级应用的完整 AI Agent 开发参考。
Stars: 680 | Forks: 366
欢迎使用 Strands Agents 示例代码库!
探索易于使用的示例,开始使用
Strands Agents。
本代码库中的示例仅用于**演示和教育目的**。它们展示了概念和技术,但**不适用于直接在生产环境中使用**。在生产环境中使用之前,请务必应用适当的**安全**和**测试**流程。
## 快速入门
### Python
**前置条件:**
- Python 3.10 或更高版本
- pip 包管理器
- 验证方式:`pip --version` 或 `pip3 --version`
- 通常随 Python 3.4+ 安装程序(来自 python.org)一起提供
- 如果缺少 pip,请使用以下方法之一安装:
# 方法 1 - 使用 Python 内置模块
python -m ensurepip --upgrade
# 方法 2 - 下载并运行官方安装程序
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python get-pip.py
**步骤 1:创建虚拟环境**
```
# 创建虚拟环境
python -m venv venv
# 激活虚拟环境
# 在 macOS/Linux 上:
source venv/bin/activate
# 在 Windows 上:
venv\Scripts\activate
```
**步骤 2:安装**
```
pip install strands-agents strands-agents-tools
```
**您的第一个 Agent:**
```
from strands import Agent
agent = Agent()
response = agent("Hello! Tell me a joke.")
print(response)
```
[探索 Python 教程 →](./01-tutorials/)
|
### TypeScript
**前置条件:**
- Node.js 18 或更高版本
- npm 或 yarn 包管理器
**安装:**
```
npm install @strands-agents/sdk
```
**您的第一个 Agent:**
```
import { Agent } from "@strands-agents/sdk";
async function main() {
const agent = new Agent({
systemPrompt: "You are a helpful assistant."
});
const response = await agent.invoke("Hello! Tell me a joke.");
console.log(response.toString());
}
main();
```
[探索 TypeScript 教程 →](./typescript/01-tutorials/)
|
### 模型提供商配置
按照[此处](https://strandsagents.com/latest/user-guide/quickstart/#model-providers)的说明配置您的模型提供商和模型访问权限。
## 探索代码库
###

Python 示例
- **[01-tutorials](./01-tutorials/)** - 涵盖基础知识、多 Agent 系统和部署的 Jupyter notebook 教程
- **[02-samples](./02-samples/)** - 真实世界用例和行业特定示例
- **[03-integrations](./03-integrations/)** - 与 AWS 服务和第三方工具的集成示例
- **[04-UX-demos](./04-UX-demos/)** - 带有用户界面的全栈应用程序
- **[05-agentic-rag](./05-agentic-rag/)** - 高级 Agentic RAG 模式
- **[06-edge](./06-edge/)** - 边缘设备集成,包括物理 AI 和机器人技术
###

TypeScript 示例
- **[typescript/01-tutorials](./typescript/01-tutorials/)** - TypeScript SDK 分步教程
## 许可证
本项目采用 Apache License 2.0 许可 - 详情请参阅 [LICENSE](LICENSE) 文件。
## 安全
有关更多信息,请参阅 [CONTRIBUTING](CONTRIBUTING.md#security-issue-notifications)。
标签:Agent Builder, DLL 劫持, DNS解析, LLM应用开发, MCP Server, MITM代理, NoSQL, Python, Strands Agents, TypeScript, 代码示例, 大语言模型, 安全插件, 开发工具包, 开源项目, 教程, 数据分析, 无后门, 模型驱动, 漏洞利用检测, 示例代码, 网络调试, 自动化, 逆向工具