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
matsukada
December 23, 2025
3
380
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
AIエージェント開発/運用入門 ~re:Invent 2025 新機能活用Edition~
licux
1
250
フレームワークを活用したAIエージェントの評価 ~AIエージェントを育てるために~
licux
11
3.3k
Tool Catalog Agent for Bedrock AgentCore Gateway
licux
8
3.5k
Langfuseと歩む生成AI活用推進
licux
3
500
Amazon Q CLI開発で学んだAIコーディングツールの使い方
licux
3
310
Bedrock AgentCore ObservabilityによるAIエージェントの運用
licux
10
1.7k
生成AI活用基盤による改革推進 ~LangChain Meetup Tokyo #6~
licux
4
630
生成AIを活用した組み込みSW設計書検索システム開発
licux
7
1.8k
MCP Server as a Judge
licux
26
5.8k
Featured
See All Featured
The Power of CSS Pseudo Elements
geoffreycrofte
80
6.2k
How to optimise 3,500 product descriptions for ecommerce in one day using ChatGPT
katarinadahlin
PRO
0
3.4k
Statistics for Hackers
jakevdp
799
230k
Code Reviewing Like a Champion
maltzj
527
40k
Leveraging Curiosity to Care for An Aging Population
cassininazir
1
160
世界の人気アプリ100個を分析して見えたペイウォール設計の心得
akihiro_kokubo
PRO
66
37k
Agile Leadership in an Agile Organization
kimpetersen
PRO
0
80
Mobile First: as difficult as doing things right
swwweet
225
10k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
35
2.4k
Avoiding the “Bad Training, Faster” Trap in the Age of AI
tmiket
0
76
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
47
7.9k
JAMstack: Web Apps at Ludicrous Speed - All Things Open 2022
reverentgeek
1
340
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