← Financial Cloud Cloud Cloud Club · AWS Re:cap

极点宏观|Financial Cloud Cloud · AWS Re:cap

AWS Re:cap 04: 以 Bedrock AgentCore 打造 Serverless AR 游戏

演讲者: Cyrus Wong

场次: 04

场次
Summit Dev Lounge2026 Re:cap
01 把架构写成 Steering,引导 AI Agent
02 Agent Harness 才是真正的工程护城河
03 用白话询问可观测性数据
04 以 Bedrock AgentCore 打造 Serverless AR 游戏
05 AgentCore 上的多 Agent 量化回测
06 三分钟用 Kiro 把博客变成幻灯片
AWS Community Day Hong Kong 2025 Re:cap
02 使用 Terraform 实现 AWS 合规
03 从初学者到构建者:一段精彩的 AWS 云之旅
04 以团队为先:使用 Laravel 与 Bref 开展无服务器工程
05 活动开幕式
06 智能体到智能体:在 AWS 上构建可互操作的 AI
07 利用另一类遥测数据,借助 AI 智能体更快改进
08 告别氛围编程:使用 Kiro 进行规格驱动开发
09 使用 MCP 与 AI 智能体进行自动化测试
10 使用机器学习方法实现电信安全现代化
11 重新思考生成式 AI 智能体:RAG 与 MCP
12 使用 TAK 和 AWS 开展灾难与应急响应
13 从测试视角重新思考无服务器应用程序工作流
14 Practical AWS FinOps for Cloud Success
15 基于 AWS 的 AI 驱动全球纯 Alpha 宏观交易:重塑风险调整后资产收益
FSI Recap
01 现代交易生命周期:从交易到结算
02 Goldman Sachs:通过 Fast Track 加速应用程序上云 - AWS Re:cap Q1/2023
03 Zurich Insurance Group:在 AWS 上构建高效的日志管理解决方案
04 FSI Meetup 2025 年第四季度 - Brex 数据库灾难恢复
05 FSI Meetup 2025 Q4 - Graviton 迁移成功案例
06 FSI Meetup 2025 Q4 - Stifel 现代数据平台
07 FSI Meetup 2025 Q4 - PayPal 金融交易数据对账系统
08 FSI Meetup 2025 Q4 - 规模化提升韧性
09 最大限度提高 AI 推理成本效益:战略性采用 AWS GPU 实例
10 高级智能体 AI 设计模式
11 在 AWS 上构建全新的现代化应用
AWS re:Invent 2025
01 Coinbase re:Invent 回顾 (IND3312)
02 利用 AI 和 AWS 构建未来交易平台
03 交易创新:Jefferies 基于 Amazon Bedrock 构建的 AI 助手 (IND3315)
04 FSI 如何通过 Agentic AI (GBL302) 彻底改变 HFT 分析
05 使用 Amazon Time Sync 改进分布式系统(采用 Nasdaq)
06 Amazon Aurora HA 和 DR 全球弹性设计模式 (DAT442)
07 构建智能体式 AI:Amazon Nova Act 与 Strands Agents 实践 (DEV327)
08 深入探讨 Amazon Aurora 及其创新 (DAT441)
09 深入探讨 Amazon S3(STG407)
10 Nasdaq:为全球金融服务构建弹性基础设施 (HMC327)
11 AWS Lambda 新功能 (CNS376)
12 使用 Kiro 进行规范驱动开发 (DEV314)
13 Amazon 的 FinOps:全球电商巨头的云成本管理经验 (AMZ308)
14 AWS 上交易平台的 Tick-to-Trade 延迟
政务数据
01 The AI Era: The Boundary Between Development and Design Is Disappearing
02 端侧多模态 AI 与智慧城市实践
03 大模型能力评测与 AI 项目落地方法论
04 基于云代理的政府开发全链路受控自动化
05 从多智能体看 Agent 时代软件新生态
06 AI 驱动的宏观量化研究与智慧治理
07 公共数据授权运营与智慧政务实践
08 数据资产化落地实践:确权合规、工程治理与数字政府案例
09 AI技术赋能心理健康公益:可信平台的治理、架构与实践
Amarathon 2025 回顾
01 开发者的智能体架构设计路线图
02 Amazon Bedrock 数据自动化
03 AgentCore 上的多智能体
04 实践中构建智能体式 AI:Nova Act 与 Strands Agents
04 使用规格驱动开发,通过 Kiro 加速迁移项目
06 从「匹配」到「理解」:由 AgentCore Memory 驱动的个性化 AI 搜索实践
07 从观察到优化:从 LLM 可观测性迈向 AIOps,将实时洞察转化为智慧自动化
08 部署 TEAM 并打造最佳工程团队
09 五年来所谓无服务器数据库带来的五个惨痛教训
14 如果 AI 替我工作会怎样:Q Developer CLI 与 Kiro 如何改变我的日常工作
16 兼顾速度与警觉:Amazon Bedrock Agent 开发的安全要点
26 在单张 H100 上运行 OSS LLM:更智能、更便宜、更快速
28 现代统一元数据架构:打破数据孤岛的新方法
29 无服务器 MediaOps:使用 Amazon Web Services 上的 AI 自动化视频工作流
30 通过大规模性能测试构建兼具效率与可靠性的架构
31 通过开源连接世界:技术、社区与全球开发者关系的实践历程
33 构建流式 Iceberg 表以进行实时物流分析
34 加速大规模机器人策略训练:基于 Kiro、Trainium 和 EKS 的自动化闭环架构
35 通过规格驱动开发,从 Vibe 走向可行方案
36 让云成本分析更智能:使用 Strands 和 AgentCore 构建 FinOps 智能体
37 使用 CNCF Kagent、K8sGPT 和 Nova Sonic 转型 K8s 对话式智能体 AIOps

AWS Hong Kong Summit 2026 · Developer Lounge 精华回顾 · 第 4 / 6 篇

AWS Magazine · 维多利亚港现场报道


现场:中环 swagger 遇上 Serverless 咒术

过去六十年追踪科技变迁,我站过数百个展场,但很少有地方能媲美 AWS Hong Kong Summit 2026 Developer Lounge 那股电流般的脉动。

倚着维多利亚港壮阔天际,Developer Lounge 是香港奢华与 AWS 高科技工艺的正面碰撞。想象一下:风投与创业公司创始人边喝精品手冲咖啡边谈七位数交易,国际讲者交换架构图,私人开发者聚会里高风险风投话题此起彼落。资金进进出出,合作即兴成形;在霓虹闪烁与中环能量之中,工程师围在屏幕前,见证纯粹的 serverless 咒术。

Lounge 最吸睛的展示?Cyrus Wong 把奢华娱乐与云工程合而为一的 demo:咒术回战领域展开 AR 游戏。

「唔错喎!反应好似我去抢购减价化妆品噉快!当堂顺眼好多!」 (Not bad! Your reaction is almost as fast as me grabbing a limited-edition bag in Shibuya!)

对着镜头比出五条悟的 Unlimited Void(无量空处)或两面宿傩的 Malevolent Shrine(伏魔御厨子)手势,屏幕立刻爆开 3D 粒子特效,真实(或模拟)人形机器人摆出功夫架式——全程由 AI 评论员以时髦、爱时尚的本地粤语即时解说。

以下是这款同人应用如何以 AWS Bedrock AgentCore、AWS CDK 与 serverless 编排构建的深入实战架构拆解。


全场焦点:AI 评论员钉崎野蔷薇

体验核心是仿 Kugisaki Nobara(钉崎野蔷薇) 打造的 AI 评论员。多模态 AI 视觉驱动,她即时吐槽玩家的手势、穿搭、姿势,甚至凌乱的房间。

多语支持与视觉智慧

● 语言:本地粤语、台湾华语、日语与英语。

● 个性:中环高级时尚 × 动画咒术。

● 模型堆叠:moonshotai.kimi-k2.5 在 Bedrock 自定义 ECR 容器内执行,搭配 AWS Polly 高保真神经语音合成。

系统架构总览

接口 / 功能 模型与基础设施实现 关键服务堆叠
AI 评论员(Nobara) 通过 moonshotai.kimi-k2.5 进行视觉感知文字推理 AWS Bedrock AgentCore Runtime
语音合成(TTS) 神经粤语、华语、日语、英语 AWS Polly & Amazon S3
手势追踪 60 FPS 的 21 个 3D 地标点 Google MediaPipe Hands(Client JS)
机器人控制 硬件与 3D 模拟器 MQTT 架式 AWS IoT Core & AWS Lambda
基础设施 100% 基础设施即代码 AWS CDK(TypeScript)

逐步实战执行流程

+-----------------------------------------------------------------------------------+
端到端手势到语音流程

1. [ Browser Client ] -- MediaPipe 60FPS --> [ API Gateway ]
2. [ API Gateway ] -- Cognito JWT --> [ Monolithic Lambda ]
3. [ Monolithic Lambda ] -- XML multimodal payload --> [ AgentCore Runtime ]
4. [ AgentCore Runtime ] --> [ AWS Polly ] neural speech
5. [ AWS Polly ] --> [ S3 Audio Bucket ] --> browser playback
+-----------------------------------------------------------------------------------+

步骤 A:客户端手势检测与 API 信号

浏览器执行 hand_tracker.js,以 Google MediaPipe Hands 分析 21 个 3D 地标点、60 FPS。手势(例如 Malevolent Shrine)验证后,battle.js 带 Cognito Bearer JWT 向 Amazon API Gateway 送出 POST 请求:

// battle.js: Dispatching recognized gesture to API Gateway[cite: 1]
async function triggerCursedTechnique(techniqueName) {
    const token = await getCognitoAccessToken(); // High-security Bearer Token[cite: 1]
    try {
        const response = await fetch("/api/trigger-technique", {
            method: "POST",
            headers: {
                "Content-Type": "application/json",
                "Authorization": `Bearer ${token}`
            },
            body: JSON.stringify({
                technique: techniqueName, // e.g. "malevolent_shrine"[cite: 1]
                robotId: "all",
                sessionId: "mcpserver"
            })
        });
        const result = await response.json();
        playCommentaryAudio(result.audioUrl); // Play resulting neural voice track[cite: 1]
    } catch (err) {
        console.error("Failed to execute server-side technique orchestration:", err); //[cite: 1]
    }
}

步骤 B:Cognito 授权与 XML Base64 绕道

API Gateway 验证 token 后,将请求转发至单体 Flask Lambda(lambda_function.py)。

为避免企业网络代理在传输中剥除二进制 multipart 影像数据,commentary.py 将网络摄像头快照嵌入文字 payload 的自定义 XML 标签:

# commentary.py: Packaging snapshots inside XML text tags[cite: 1]
def generate_ai_commentary(content_block, session_id="mcpserver", image_base64_p1=""):
    if image_base64_p1:
        content_block += f"\n<p1_webcam_base64_jpeg>{image_base64_p1}</p1_webcam_base64_jpeg>" #[cite: 1]

    agent_client = boto3.client("bedrock-agentcore", region_name="us-east-1") #[cite: 1]

    payload_dict = {
        "prompt": content_block,
        "session_id": session_id
    }

    response = agent_client.invoke_agent_runtime(
        agentRuntimeArn=os.environ.get("AGENTCORE_RUNTIME_ARN"),
        runtimeSessionId=session_id,
        payload=json.dumps(payload_dict).encode("utf-8")
    )
    return response.get("response").read().decode("utf-8") #[cite: 1]

步骤 C:Serverless AgentCore Runtime 执行

AWS Bedrock AgentCore Runtime 通过 IAM SigV4 将调用路由至自定义容器(domain_commentator_agentcore)。容器内 FastAPI 服务(commentator_agent.py)以 regex 抓取 base64 XML 区块,重建 Bedrock 的二进制多模态 payload:

# commentator_agent.py: Unwrapping XML image parts inside container[cite: 1]
@app.post("/invocations")
async def invoke_agent(request: Request):
    body = await request.json()
    prompt_text = body.get("prompt", "")

    p1_pattern = re.compile(r"<p1_webcam_base64_jpeg>(.*?)</p1_webcam_base64_jpeg>", re.DOTALL) #[cite: 1]
    p1_match = p1_pattern.search(prompt_text)

    image_b64_p1 = ""
    if p1_match:
        image_b64_p1 = p1_match.group(1).strip()
        prompt_text = p1_pattern.sub("", prompt_text).strip() # Clean text prompt[cite: 1]

    img_bytes_p1 = base64.b64decode(image_b64_p1)
    message_content = [
        {"text": "Player 1 webcam snapshot:"},
        {"image": {"format": "jpeg", "source": {"bytes": img_bytes_p1}}},
        {"text": prompt_text}
    ]

    response = await strands_agent.invoke_async(message_content) #[cite: 1]
    return JSONResponse(content={"response": str(response)}, status_code=200) #[cite: 1]

步骤 D:通过 AgentCore Tool Gateway 派发硬件指令

模型触发实体动作时,runtime 调用 AgentCore Tool Gateway(bedrockagentcore.Gateway),再通过 IAM SigV4 调用 robot_tool_lambda.py,向 AWS IoT Core 发布 MQTT 指令:

# robot_tool_lambda.py: Stripping tool prefix and invoking IoT Core[cite: 1]
def lambda_handler(event, context):
    full_tool_name = event.get("tool_name", "") # e.g., "robot-only-mcp-lambda___robot_wave"[cite: 1]
    local_tool_name = full_tool_name.split("___")[-1] if "___" in full_tool_name else full_tool_name #[cite: 1]

    if local_tool_name == "robot_wave":
        iot_client = boto3.client("iot-data")
        iot_client.publish(
            topic="arn:aws:iot:us-east-1:123456789012:topic/robot_1/topic",
            qos=1,
            payload=json.dumps({"action": "wave_hand", "timestamp": int(time.time())})
        )
        return {"status": "SUCCESS", "message": "Robot hand wave triggered."} #[cite: 1]


基础设施即代码:CDK 核心模式

为让基础设施可重复、现代且干净,整个系统以 AWS CDK 建模。

1. 集中式 Tool Gateway Construct(robot-tool-gateway.ts)

// Constructing the Tool Gateway with IAM SigV4 security[cite: 1]
export class RobotToolGatewayConstruct extends Construct {
  public readonly robotToolFunction: PythonFunction;
  public readonly gateway: bedrockagentcore.Gateway;

  constructor(scope: Construct, id: string, props: RobotToolGatewayConstructProps) {
    super(scope, id);

    this.robotToolFunction = new PythonFunction(this, "RobotToolFunction", {
      entry: path.join(__dirname, "../../../mcp_server"),
      runtime: SHARED_PYTHON_RUNTIME,
      index: "robot_tool_lambda.py",
      handler: "lambda_handler",
      timeout: Duration.seconds(30),
    });

    this.gateway = new bedrockagentcore.Gateway(this, "RobotToolGateway", {
      description: "AgentCore gateway fronting the robot Lambda tools",
      authorizerConfiguration: bedrockagentcore.GatewayAuthorizer.usingAwsIam(), // SigV4 Auth[cite: 1]
    });

    this.gateway.addLambdaTarget("RobotToolLambdaTarget", {
      gatewayTargetName: "robot-only-mcp-lambda",
      lambdaFunction: this.robotToolFunction,
      toolSchema: bedrockagentcore.ToolSchema.fromLocalAsset(materializeRobotToolSchemaAsset()),
    });
  }
}

2. Serverless AgentCore 评论员 Runtime(domain-expansion-serverless.ts)

// Deploying commentator runtime with cost-aware lifecycles[cite: 1]
const runtime = new agentcore.Runtime(this, "Runtime", {
  runtimeName: "domain_commentator_agentcore",
  agentRuntimeArtifact: agentcore.AgentRuntimeArtifact.fromAsset(
    path.join(__dirname, "../../../domain-expansion-commentator-agentcore"),
    { platform: Platform.LINUX_ARM64 }
  ),
  authorizerConfiguration: agentcore.RuntimeAuthorizerConfiguration.usingIAM(),
  lifecycleConfiguration: {
    idleRuntimeSessionTimeout: Duration.seconds(120), // 2 min idle timeout[cite: 1]
    maxLifetime: Duration.seconds(900),              // 15 min max session[cite: 1]
  },
  tracingEnabled: true,
  environmentVariables: {
    BEDROCK_MODEL_ID: "moonshotai.kimi-k2.5",
  },
});


分流式 API Gateway 安全模型

团队实现分流 REST 模型,解决经典 Web 冲突:标准浏览器元素(<img src="...">)无法带 Bearer header,但写入操作会消耗 LLM 费用。

// Public vs Protected Endpoint Configuration[cite: 1]
const restApi = new apigateway.RestApi(this, "DomainExpansionRestApi", {
  restApiName: "Domain Expansion Serverless REST API",
});

const restAuthorizer = new apigateway.CognitoUserPoolsAuthorizer(this, "DomainExpansionRestApiAuthorizer", {
  cognitoUserPools: [props.userPool],
});

// 🔓 PUBLIC READ-ONLY ENDPOINTS (No Cognito Token required)[cite: 1]
apiResource.addResource("get-snapshot").addMethod("GET", lambdaIntegration, {
  authorizationType: apigateway.AuthorizationType.NONE, //[cite: 1]
});

// 🔒 PROTECTED WRITE ENDPOINTS (Strict Cognito Validation)[cite: 1]
apiResource.addResource("trigger-technique").addMethod("POST", lambdaIntegration, {
  authorizationType: apigateway.AuthorizationType.COGNITO, // Edge validation[cite: 1]
  authorizer: restAuthorizer,
});


可观测性与企业级追踪

可观测性通过 CloudWatch Vended Logs 命名空间与 AWS X-Ray 处理:

// Configuring Vended Logs namespace for AgentCore[cite: 1]
const applicationLogGroup = new logs.LogGroup(scope, `${id}ApplicationLogGroup`, {
  logGroupName: `/aws/vendedlogs/bedrock-agentcore/gateway/APPLICATION_LOGS/${gateway.gatewayId}`, //[cite: 1]
  retention: logs.RetentionDays.THREE_DAYS,
});

这确保在单一 X-Ray 地图上进行端到端分布式追踪:

Browser Gesture → API Gateway → Lambda Router → AgentCore Container → Strands LLM → AWS Polly TTS。


智慧客户端防护与角色工程

1. 成本防护会话逻辑(auth-check.js)

为避免闲置标签页维持 AgentCore socket 连接造成账单外泄,客户端每 30 秒在设备上检查 Cognito JWT:

Session Expired = currentTime >= jwt.exp

若已过期,立即关闭作用中的 WebSocket:

function checkSessionGuard() {
    const token = getCognitoToken();
    if (isTokenExpired(token)) {
        if (webSocketConnection) webSocketConnection.close(); // Prevent billing leaks[cite: 1]
        triggerLocalLogout();
    }
}
setInterval(checkSessionGuard, 30000); // 0 cloud compute overhead[cite: 1]

2. 语音文字清理(commentary_tts.py)

将模型输出交给 AWS Polly 前,以 BeautifulSoup 把 Markdown 符号(**bold**、#)转成干净纯文字,避免 Polly 念出语法:

import markdown
from bs4 import BeautifulSoup

def sanitize_text_for_tts(raw_text):
    html_formatted = markdown.markdown(raw_text)
    return BeautifulSoup(html_formatted, "html.parser").get_text() # Clean plain text[cite: 1]

3. Soul as Code 配置

角色身份完全解耦为标准 Markdown 文件,在 runtime 加载:

● IDENTITY.md:呛辣粤语风格与气质指引。

● SOUL.md:战斗 lore 规则(例如如何吐槽五条悟玩家)。


架构经济学与按需付费

架构选择 成本与效率影响
零闲置计费 无对战进行时 $0.00;无需持续运行的 EC2/ECS 服务器。
S3 生命周期规则 网络摄像头快照与 Polly MP3 音频串流 7 天后自动删除。
P2P 视频 WebRTC 视频串流点对点直连;API Gateway WebSocket 仅处理轻量遥测。

结语:Developer Lounge 的氛围

Cyrus Wong 与团队在 AWS Hong Kong Summit 2026 Developer Lounge 展示的,不只是一款有趣的同人游戏,更是现代 serverless 设计的实战课:高时尚、高科技、低延迟、零闲置成本。

夕阳照进中环、点亮维多利亚港时,开发者仍围在摊位前扫 CDK 仓库、测试手势。这才是 AWS Developer Lounge 真正的精神——把世界级工程、本地文化活力与 serverless 力量,聚在同一个屋檐下。