Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
AI Chatbot with Human-in-the-Loop Using Lambda ...
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
matsukada
December 23, 2025
3
410
AI Chatbot with Human-in-the-Loop Using Lambda durable functions
JAWS-UG AI/ML #34:re:Invent 2025 Recap AI/MLでの登壇資料です。
https://jawsug-ai.connpass.com/event/377233/
matsukada
December 23, 2025
Tweet
Share
More Decks by matsukada
See All by matsukada
A2UI×AgentCore×A2Aで実現するマルチエージェントUIアーキテクチャ
licux
3
310
Advanced Tool Use for AgentCore Gateway with AgentCore
licux
2
240
AIエージェント開発/運用入門 ~re:Invent 2025 新機能活用Edition~
licux
1
270
フレームワークを活用したAIエージェントの評価 ~AIエージェントを育てるために~
licux
11
3.4k
Tool Catalog Agent for Bedrock AgentCore Gateway
licux
8
3.6k
Langfuseと歩む生成AI活用推進
licux
3
520
Amazon Q CLI開発で学んだAIコーディングツールの使い方
licux
3
320
Bedrock AgentCore ObservabilityによるAIエージェントの運用
licux
10
1.8k
生成AI活用基盤による改革推進 ~LangChain Meetup Tokyo #6~
licux
4
640
Featured
See All Featured
Six Lessons from altMBA
skipperchong
29
4.2k
KATA
mclloyd
PRO
35
15k
Visualization
eitanlees
150
17k
Agile that works and the tools we love
rasmusluckow
331
21k
技術選定の審美眼(2025年版) / Understanding the Spiral of Technologies 2025 edition
twada
PRO
117
110k
Building Adaptive Systems
keathley
44
2.9k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
46
2.7k
Agile Leadership in an Agile Organization
kimpetersen
PRO
0
94
From Legacy to Launchpad: Building Startup-Ready Communities
dugsong
0
160
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
199
72k
Designing for Timeless Needs
cassininazir
0
140
Rebuilding a faster, lazier Slack
samanthasiow
85
9.4k
Transcript
©Mitsubishi Electric Corporation AI Chatbot with Human-in-the-Loop Using Lambda Durable
Functions 三菱電機株式会社 塚田 真規
©Mitsubishi Electric Corporation 自己紹介 2 塚田 真規 Masaki Tsukada 三菱電機株式会社
デジタルイノベーション事業本部 AI戦略プロジェクトグループ • AWS Community Builder 2025 (AI Engineering) • 2024/2025 Japan AWS All Certifications Engineers • JAWS-UG AI/ML支部運営
©Mitsubishi Electric Corporation 3 NEW Lambda durable functions Easily build
long-running applications and AI workflows Matt Garman氏のKeynoteで発表 GENERALLY AVAILABLE
©Mitsubishi Electric Corporation Lambda durable functionsの特徴 • 自動チェックポイントを用いた状態管理 • ステップや待機の実行前後の情報を自動取得し、中断箇所からの再開が可能
• 並列実行も可能 • MapやParallel • 最大1年間の待機時間 • 待機中はコンピュートコストはかからない 4 AWS Lambdaでワークフローを構築可能に! Execution timeout Lambda function timeout • 1回のLambda関数呼び出しの制限時間 • 最大15分 • 開始から完了までの実行全体の制限時間 • 最大1年間 • 複数回のLambda関数呼び出しの可能性もあり
©Mitsubishi Electric Corporation Lambda durable functionsのサンプル(初期コード) 5 from aws_durable_execution_sdk_python.config import
Duration from aws_durable_execution_sdk_python.context import DurableContext, StepContext, durable_step from aws_durable_execution_sdk_python.execution import durable_execution @durable_step def my_step(step_context: StepContext, my_arg: int) -> str: step_context.logger.info("Hello from my_step") return f"from my_step: {my_arg}" @durable_execution def lambda_handler(event, context) -> dict: msg: str = context.step(my_step(123)) context.wait(Duration.from_seconds(10)) context.logger.info("Waited for 10 seconds without consuming CPU.") return { "statusCode": 200, "body": msg, } ハンドラ関数には@durable_executionデコレータを付与 - DurableContextによるチェックポイント管理が可能に チェックポイントを作成したい関数には @durable_stepデコレータを付与 実行前後で自動でチェックポイントを作成 実行を一時停止
©Mitsubishi Electric Corporation Lambda durable functionsのコードサンプル 6 @durable_execution def lambda_handler(event:
dict, context: DurableContext) -> list[str]: """並行実行""" task1 = lambda ctx: ctx.step(lambda _: "Task 1 complete", name="task1") task2 = lambda ctx: ctx.step(lambda _: "Task 2 complete", name="task2") task3 = lambda ctx: ctx.step(lambda _: "Task 3 complete", name="task3") result = context.parallel([task1, task2, task3]) return result.get_results() ] [ "Task 1 complete", "Task 2 complete", "Task 3 complete" ] • Parallel(並列実行) • 実行結果
©Mitsubishi Electric Corporation 既存サービスとの比較 7 Step Functions Lambda durable functions
• AWS全体に跨るワークフロー • Lambda内でのアプリを開発 • 独立した、専用のワークフローサービス • Lambda内部で動作 • コンソールからGUIベースでの構築 • YAML/JSONによるコード定義 • CDKなど • プログラミング言語での実装 • Node.js 22/24 • Python 3.13/3.14 • 様々なAWSサービスとの連携を想定した ワークフロー • アプリケーションロジックで管理する ワークフロー • ほぼすべてのAWSリージョン • us-east-2で提供開始(12/2) • 東京含む14リージョンが追加(12/18) AWS Step Functions 分散アプリケーションのための視覚的なワークフロー
©Mitsubishi Electric Corporation Lambda durable functionsを使ったHuman-in-the-loop AIチャットボット 8 Amazon SQS
AWS Lambda LLM推論 ツール実行 @durable_step @durable_execution context.step(~) context.step(~) @durable_step SQSへpush context.wait_for_callback(~) • クエリ • ツール承認/拒否 Long Polling Amazon S3 ツール情報 ユーザー 生成レポート 署名付きURL • Lambda→Streamlitへのデータ通知はSQSを採用 • 生成結果はS3にアップロードし、署名付きURLで共有 起動/フィードバック通知 ローカル起動
©Mitsubishi Electric Corporation 9 クエリ 入力 一定 時間後 フィード バック
フィードバック 繰り 返し
©Mitsubishi Electric Corporation 10 コールバック1回目 →APPROVE コールバック2回目 →DENY コールバック3回目 →APPROVE
ツール実行 ツール実行
©Mitsubishi Electric Corporation 請求されるコンピュート時間は? 11 待機→再開ごとにLambdaはinvokeされる様子 3回中断したので、4度のLambda invokeが発生 billedDurationMSの合計:52,101 (52秒)
©Mitsubishi Electric Corporation まとめ 12 • 「Lambda durable functions」を使用したAIチャットボットを構築 •
チェックポイントを活用したHuman-in-the-loopを搭載 • レビュー情報にはSQSを活用 • 実時間と費用請求対象のコンピュート時間を確認
None