重要前提
安装AI Skills的关键前提是:必须科学上网,且开启TUN模式,这一点至关重要,直接决定安装能否顺利完成,在此郑重提醒三遍:科学上网,科学上网,科学上网。查看完整安装教程 →
aws-agentcore by hoodini/ai-agents-skills
npx skills add https://github.com/hoodini/ai-agents-skills --skill aws-agentcore在 AWS 基础设施上构建生产级 AI 智能体。
import boto3
from agentcore import Agent, Tool
# 初始化 AgentCore 客户端
client = boto3.client('bedrock-agent-runtime')
# 定义一个工具
@Tool(name="search_database", description="Search the product database")
def search_database(query: str, limit: int = 10) -> dict:
# 工具实现
return {"results": [...]}
# 创建智能体
agent = Agent(
model_id="anthropic.claude-3-sonnet",
tools=[search_database],
instructions="You are a helpful product search assistant."
)
# 调用智能体
response = agent.invoke("Find laptops under $1000")
AgentCore 提供以下基础组件:
| 组件 | 用途 |
|---|---|
| Runtime | 无服务器智能体执行(与框架无关) |
| Gateway | 将 API/Lambda 转换为 MCP 兼容的工具 |
| Memory | 多策略记忆(语义、用户偏好) |
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
| 使用 Cognito、Okta、Google、EntraID 进行身份验证 |
| Tools | 代码解释器、浏览器工具 |
| 可观测性 | 深度分析和追踪 |
# 将 Lambda 函数作为工具
import json
def lambda_handler(event, context):
action = event.get('actionGroup')
function = event.get('function')
parameters = event.get('parameters', [])
# 解析参数
params = {p['name']: p['value'] for p in parameters}
if function == 'get_weather':
result = get_weather(params['city'])
elif function == 'book_flight':
result = book_flight(params['origin'], params['destination'])
return {
'response': {
'actionGroup': action,
'function': function,
'functionResponse': {
'responseBody': {
'TEXT': {'body': json.dumps(result)}
}
}
}
}
from agentcore import SupervisorAgent, SubAgent
# 创建专门的子智能体
research_agent = SubAgent(
name="researcher",
model_id="anthropic.claude-3-sonnet",
instructions="You research and gather information."
)
writer_agent = SubAgent(
name="writer",
model_id="anthropic.claude-3-sonnet",
instructions="You write clear, engaging content."
)
# 创建监督者
supervisor = SupervisorAgent(
model_id="anthropic.claude-3-opus",
sub_agents=[research_agent, writer_agent],
routing_strategy="supervisor" # 或 "intent_classification"
)
response = supervisor.invoke("Write a blog post about AI agents")
from agentcore import Agent, Guardrail
# 定义护栏
guardrail = Guardrail(
guardrail_id="my-guardrail-id",
guardrail_version="1"
)
agent = Agent(
model_id="anthropic.claude-3-sonnet",
guardrails=[guardrail],
tools=[...],
)
将现有 API 转换为 MCP 兼容的工具:
# gateway_setup.py
from bedrock_agentcore import GatewayClient
gateway = GatewayClient()
# 从 OpenAPI 规范创建网关
gateway.create_target(
name="my-api",
type="OPENAPI",
openapi_spec_path="./api-spec.yaml"
)
# 从 Lambda 函数创建网关
gateway.create_target(
name="my-lambda-tool",
type="LAMBDA",
function_arn="arn:aws:lambda:us-east-1:123456789:function:my-tool"
)
from agentcore import Agent, Memory
# 使用多种策略创建记忆
memory = Memory(
name="customer-support-memory",
strategies=["semantic", "user_preference"]
)
agent = Agent(
model_id="anthropic.claude-3-sonnet",
memory=memory,
tools=[...],
)
# 记忆跨会话持久化
response = agent.invoke(
"What did we discuss last time?",
session_id="user-123"
)
AWS 提供生产就绪的实现:
02-use-cases/)| 用例 | 描述 |
|---|---|
| A2A 多智能体事件响应 | 使用 Strands + OpenAI SDK 的智能体到智能体 |
| 客户支持助手 | 记忆、知识库、Google OAuth |
| 市场趋势智能体 | 使用浏览器工具的 LangGraph |
| 数据库性能分析器 | PostgreSQL 集成 |
| 设备管理智能体 | 使用 Cognito 身份验证的 IoT |
| 企业网络情报 | 用于研究的浏览器工具 |
| 文本到 Python IDE | AgentCore 代码解释器 |
| 视频游戏销售助手 | Amplify + CDK 部署 |
git clone https://github.com/awslabs/amazon-bedrock-agentcore-samples.git
cd amazon-bedrock-agentcore-samples/02-use-cases/customer-support-assistant
# 按照 README 进行部署
每周安装数
68
仓库
GitHub 星标数
134
首次出现
2026年1月24日
安全审计
安装于
opencode59
codex57
gemini-cli56
github-copilot55
cursor51
claude-code49
Build production-grade AI agents on AWS infrastructure.
import boto3
from agentcore import Agent, Tool
# Initialize AgentCore client
client = boto3.client('bedrock-agent-runtime')
# Define a tool
@Tool(name="search_database", description="Search the product database")
def search_database(query: str, limit: int = 10) -> dict:
# Tool implementation
return {"results": [...]}
# Create agent
agent = Agent(
model_id="anthropic.claude-3-sonnet",
tools=[search_database],
instructions="You are a helpful product search assistant."
)
# Invoke agent
response = agent.invoke("Find laptops under $1000")
AgentCore provides these primitives:
| Component | Purpose |
|---|---|
| Runtime | Serverless agent execution (framework-agnostic) |
| Gateway | Convert APIs/Lambda to MCP-compatible tools |
| Memory | Multi-strategy memory (semantic, user preference) |
| Identity | Auth with Cognito, Okta, Google, EntraID |
| Tools | Code Interpreter, Browser Tool |
| Observability | Deep analysis and tracing |
# Lambda function as tool
import json
def lambda_handler(event, context):
action = event.get('actionGroup')
function = event.get('function')
parameters = event.get('parameters', [])
# Parse parameters
params = {p['name']: p['value'] for p in parameters}
if function == 'get_weather':
result = get_weather(params['city'])
elif function == 'book_flight':
result = book_flight(params['origin'], params['destination'])
return {
'response': {
'actionGroup': action,
'function': function,
'functionResponse': {
'responseBody': {
'TEXT': {'body': json.dumps(result)}
}
}
}
}
from agentcore import SupervisorAgent, SubAgent
# Create specialized sub-agents
research_agent = SubAgent(
name="researcher",
model_id="anthropic.claude-3-sonnet",
instructions="You research and gather information."
)
writer_agent = SubAgent(
name="writer",
model_id="anthropic.claude-3-sonnet",
instructions="You write clear, engaging content."
)
# Create supervisor
supervisor = SupervisorAgent(
model_id="anthropic.claude-3-opus",
sub_agents=[research_agent, writer_agent],
routing_strategy="supervisor" # or "intent_classification"
)
response = supervisor.invoke("Write a blog post about AI agents")
from agentcore import Agent, Guardrail
# Define guardrail
guardrail = Guardrail(
guardrail_id="my-guardrail-id",
guardrail_version="1"
)
agent = Agent(
model_id="anthropic.claude-3-sonnet",
guardrails=[guardrail],
tools=[...],
)
Convert existing APIs to MCP-compatible tools:
# gateway_setup.py
from bedrock_agentcore import GatewayClient
gateway = GatewayClient()
# Create gateway from OpenAPI spec
gateway.create_target(
name="my-api",
type="OPENAPI",
openapi_spec_path="./api-spec.yaml"
)
# Create gateway from Lambda function
gateway.create_target(
name="my-lambda-tool",
type="LAMBDA",
function_arn="arn:aws:lambda:us-east-1:123456789:function:my-tool"
)
from agentcore import Agent, Memory
# Create memory with multiple strategies
memory = Memory(
name="customer-support-memory",
strategies=["semantic", "user_preference"]
)
agent = Agent(
model_id="anthropic.claude-3-sonnet",
memory=memory,
tools=[...],
)
# Memory persists across sessions
response = agent.invoke(
"What did we discuss last time?",
session_id="user-123"
)
AWS provides production-ready implementations:
Repository : https://github.com/awslabs/amazon-bedrock-agentcore-samples
02-use-cases/)| Use Case | Description |
|---|---|
| A2A Multi-Agent Incident Response | Agent-to-Agent with Strands + OpenAI SDK |
| Customer Support Assistant | Memory, Knowledge Base, Google OAuth |
| Market Trends Agent | LangGraph with browser tools |
| DB Performance Analyzer | PostgreSQL integration |
| Device Management Agent | IoT with Cognito auth |
| Enterprise Web Intelligence | Browser tools for research |
| Text to Python IDE | AgentCore Code Interpreter |
| Video Games Sales Assistant | Amplify + CDK deployment |
git clone https://github.com/awslabs/amazon-bedrock-agentcore-samples.git
cd amazon-bedrock-agentcore-samples/02-use-cases/customer-support-assistant
# Follow README for deployment
Weekly Installs
68
Repository
GitHub Stars
134
First Seen
Jan 24, 2026
Security Audits
Gen Agent Trust HubFailSocketPassSnykWarn
Installed on
opencode59
codex57
gemini-cli56
github-copilot55
cursor51
claude-code49
React 组合模式指南:Vercel 组件架构最佳实践,提升代码可维护性
122,000 周安装