Amazon Bedrock と AWS Lambda を活用したエージェント型アプリデプロイヤーの構築
本文の状態
日本語全文を表示中
詳細モードで約22分の本文を読めます。
同じ出来事の情報源
この情報源を基点に整理
AWS Machine Learning Blog
PDI Technologies は、開発リソースを割く必要のない小規模な社内ツールの迅速な実装とデプロイを実現するため、Amazon Bedrock と AWS Lambda を組み合わせたエージェント型アプリデプロイヤーを構築した。
AI深層分析を開く2026年8月7日 01:59
AI深層分析
キーポイント
PDI Brew の概要と目的
非技術者が自然言語でツール要件を記述するだけで、Git やターミナル操作、DevOps 知識なしに AWS で動作する Web アプリケーションを即座に構築・展開できる自律型デプロイヤーである。
エージェントによるプロビジョニング
計画エージェントがユーザーの意図を構造化マニフェストに変換し、AWS Lambda で動作する提供エージェントがそのマニフェストに基づいてリソースを分類・選択・作成する一連のプロセスを実行する。
統制された AI 機能の統合
構築されたすべてのアプリはプラットフォームを通じて、モデルエンドポイントや API キーに触れることなく、Chat、要約、分類などの統制された AI 機能を安全に利用可能となる。
セキュリティとコスト管理
シングルサインオン(SSO)による保護、最小権限のゲートウェイ設計、およびスケーラブルな運用におけるコストプロファイルやガバナールールの実装が紹介されている。
従来の社内ツールの課題
従来のアプローチでは単なる計算ツールでもリポジトリやビルドパイプライン、認証統合などフルな開発ライフサイクルのコストを伴う。その結果、収益創出機能に優先順位が後回しになり、小さなツールの永続的な待ち行列が発生する。
重要な引用
A non-technical employee describes the tool they want in plain English, and within seconds they receive a fully provisioned, multi-tenant web application.
The person who needs the tool is the person who ships it.
This occurs without its author ever touching a model endpoint or an API key.
"Agentic" does not need to mean "a large language model in the request path for every decision."
編集コメントを表示
編集コメント
この事例は、AI エージェントが単なるチャットボットを超えて、インフラのプロビジョニングやリソース管理といった実務的なタスクを自律的に実行する「アジェンシー」の具体例として注目される。非技術者が直接 AI に指示を出すことで開発プロセスが民主化され、組織全体のイノベーション速度が向上する可能性を示唆している。
Source Article
元記事を日本語で読む
本文に関係しない購読案内、埋め込み通知、サイト内プロモーションは除いています。
多くの企業には、結局作られずに終わる社内ツールの「長尾」が存在します。配送コスト計算機のようなものや、単純な申込フォーム、スプレッドシート用の小型ダッシュボードが必要になるケースは珍しくありませんが、それら一つひとつに開発者やバックログの枠、デプロイパイプラインを割く必要があります。ツールは優先順位をつけるには小さすぎ、無視するには多すぎます。
PDI Technologies はコンビニエンスストア小売業と石油卸売業界向けに事業を展開し、世界中の企業がデータと業務を安全に連携させることで効率性と収益性を向上できるよう支援しています。同社は 40 年の歴史を持ち、約 4,000 名の従業員を抱え、200 を超える国・地域で 20 万カ所以上の顧客拠点にサービスを提供しています。PDI は、従来のデプロイパイプラインが非技術チームのツール開発を阻害していることに気づきました。
その課題解決のため、PDI Technologies は「PDI Brew」を開発しました。非技術系の従業員が欲しいツールを平易な英語で記述するだけで、数秒以内にシングルサインオン(SSO)で保護され、AWS 上で稼働するマルチテナント型の Web アプリケーションが完全にプロビジョニングされます。Git もターミナルも不要、DevOps の知識も必要ありません。ツールが必要な人が、そのままそのツールをリリースします。すべてのアプリが共通のプラットフォームを引き継ぐため、各アプリは Amazon Bedrock を基盤とした統制された AI 機能(チャット、要約、分類など)を任意で利用できます。これらは、作成者がモデルエンドポイントや API キーに直接触れることなく実現されます。
本稿では、PDI Technologies が「アジェンティック・プロビジョニングパターン」を基盤として構築した「PDI Brew」について紹介します。このシステムでは、プランニングエージェントが AI アシスタント(Claude や ChatGPT、Claude Code など)のスキル、あるいは AWS の信頼境界内での Amazon Bedrock モデル呼び出しを通じて、ユーザーの意図を構造化されたマニフェストとして捉えます。その後、AWS Lambda 上で動作するプロビジョニングエージェントがそのマニフェストを分解し、ワークロードの分類やツールの選定を行い、一連のリクエストですべての下流 AWS リソースの作成をオーケストレーションします。
さらに、本プラットフォームがどのようにして、Amazon Bedrock へのアクセスを統制された最小権限のゲートウェイとしてアプリ内 AI に提供しているかも解説します。ここではアーキテクチャ、セキュリティモデル、Lambda 内で実行される長時間プロセス、AI ガイドレールと予算管理の設計思想、そして大規模運用時のコスト構造について詳しく説明します。
前提条件
本記事で解説するアーキテクチャを理解するには、AWS Lambda、Amazon API Gateway、Amazon DynamoDB、Amazon Simple Storage Service (S3)、Amazon CloudFront、そして Amazon Bedrock といった AWS サービスの知識があると役立ちます。また、認証関連のセクションでは、Microsoft Entra ID(旧 Azure AD)や MSAL.js の経験も有益です。
同様のパターンを自環境で実装する場合は、AWS Command Line Interface (AWS CLI) がインストールされ、IAM ロールとポリシーを作成できる十分な権限を持つ資格情報で設定済みであることを確認してください。
社内ツールの課題
従来の社内ツール開発では、単純な業務ニーズに対して、フルソフトウェアのデリバリーライフサイクルが適用されてきました。単なる電卓アプリ一つとっても、リポジトリ管理、ビルドパイプライン、認証連携、ホスティングの選定、TLS 証明書の取得、DNS 設定、ログ収集、そして継続的な保守といったコストをすべて背負わなければなりません。
その結果、収益に直結する機能よりも優先度が低い小さなツールが常時キューに残り、一向に進捗しない状態が生まれていました。
私たちは、以下の4つの特性を持つシステムを目指しました:
- 入力された意図から、即座にアプリケーションを出力する。利用者がツールの要件を記述するだけで、プラットフォームが自動的にプロビジョニングします。エンジニアへの引き継ぎは不要です。
- デフォルトでセキュリティとガバナンスを実現する。すべてのアプリが、エンタープライズレベルの SSO、スコープ限定された IAM、HTTPS 化、そして集中型の観測性を自動的に継承します。「安全でない」経路が存在しないことが保証されています。
サーバーレスかつゼロスケール対応。数百もの小規模アプリがアイドル状態でもコストをほぼゼロに抑え、パッチ適用や容量計画のための共有サーバーは不要です。
AI は無制限に使わせない。アプリで生成 AI を利用する場合は、ガードレール、クォータ管理、完全な監査証跡を持つ制御された経路を通じてのみ許可します。個別のモデルキーを埋め込むことは絶対にありません。
ソリューション概要
「エージェント」という言葉は、「すべての意思決定に大規模言語モデル(LLM)がリクエストパスに含まれること」を意味する必要はありません。ここでは、目標を設定し、それを分解し、ツールを選択してその目標に向かって行動するシステムをエージェントと定義します。
PDI Brew では、この定義の 2 つの側面を、信頼性が大きく異なる 2 つのエージェントに分離しています。
プランニングエージェントは意図を把握します。ユーザーへのインタビューを通じて希望を整理し、アプリケーションのフロントエンドを生成し、何よりも重要なのは、構造化されたデプロイマニフェスト(アプリ名、タイプ、データスキーマ、アクセス制御設定などからなる JSON 形式のユーザー意図記述)を発行することです。このプランニングロジックは「Vibe App Builder スキル」としてパッケージ化されており、従業員がすでに利用している AI アシスタント内で実行されます。プランナーを既存のアシスタント内に配置することで、ユーザーは既に開いているツールの中で豊かな対話体験を得られつつ、AWS 側の攻撃対象領域を最小限に抑えることができます。
プロビジョニングエージェントは、AWS Lambda 関数として実装されています。マニフェストを受け取り、決定論的かつ監査可能なツール使用オーケストレーターとして機能します。リクエストの検証、ワークロードの分類、そして適切なプロビジョニング経路の選択を行います。その後、AWS や Microsoft Graph の API をツールとして呼び出し、長時間実行されるステップは非同期での自己呼び出しで処理し、最終的にライブ URL を返します。
プロビジョニングロジックをチャットセッション内ではなく Lambda 内に配置したのは意図的な設計です。プロビジョニングこそが、すべての決定がログに残され、再現可能であり、ハルシネーション(幻覚)が生じないことが求められるワークロードの典型だからです。
プラグイン可能なプランナー:お好みのアシスタントを接続する
意図はあらゆる場所から来る可能性があるため、プランナーはプラグイン可能なレイヤーとして設計されており、2 つの切り替え可能なパスを持っています。単一の環境変数(PLANNER_MODE)でどちらを有効にするかを選択し、両方のパスが同一のデプロイマニフェストを出力するため、その後の処理フローは一切変更されません。
パス A:あらゆる AI アシスタントに備わる「Vibe スキル」
Vibe App Builder スキル(以降、Vibe スキルと呼ぶ)は、プランニングロジックをパッケージ化し、従業員がすでに使用している任意の AI アシスタント内で実行されます。アシスタントがユーザーへのインタビューを行い、フロントエンドを生成した上でマニフェストを作成します。このプランナーは AWS 外で動作するため、ユーザーは既に開いているツールの中で豊かな対話体験を得ることができます。
パス B は、AWS の信頼境界内にある Amazon Bedrock を利用する構成です。Teams や Web フォーム、IDE などのチャネルでは、リクエストが Amazon Bedrock に送信されます。Bedrock モデルの呼び出し(InvokeModel)がプランナーとして機能し、ワークロードを分類するとともに、同じマニフェストを出力します。また、プロビジョニング前にデータスキーマの検証や修復も可能です。このパスは AWS 内で完結するため、すべての決定が AWS CloudTrail に記録され、モデル呼び出し ID と紐付けられます。意図データが AWS の境界外に流出することもないため、データ所在地に関する厳格な要件を持つチームにとって重要な構成です。
プロビジョニングエージェントは 1 つのみです。どちらのプランナーも同じマニフェスト JSON を出力するため、Lambda 上のプロビジョニングエージェントと各アプリの実行時環境はパスに関わらず同一になります。Bedrock パスの追加は書き換えではなく付加機能であり、PLANNER_MODE は組織、ワークスペース、ユーザー単位で固定できます。これにより、ある企業では Bedrock パスを必須としつつ、別の企業ではアシスタント内での体験を維持することも可能です。さらに、将来的には Bedrock 呼び出しを より高度なマネージドエージェントランタイム に置き換えることも可能で、パス A やプロビジョニングエージェントに影響を与えることなく移行できます。
アーキテクチャ
以下の図は、エンドツーエンドのアーキテクチャを示しています。この構成には 3 つのレイヤーがあります。
- プラグイン可能な意図と計画のレイヤー
- 統合されたエージェント型プロビジョニングランタイム(AWS Lambda 上で動作)
- アプリごとのランタイム
これらは、エッジ、ID、観測性を提供する共有サービスによって支えられています。

以下に、リクエストが各レイヤーをどのように通過するかを追跡します。
- 意図と計画のレイヤーでは、従業員がツールについて平易な英語で説明します。
PLANNER_MODEの設定に応じて、プランナーは 2 つの経路のいずれかになります。Path A では、アシスタント内で動作する Vibe Skill が担当し、Path B では Slack や Teams などのチャネルを介して Amazon Bedrock を呼び出す仕組みが用いられます。どちらの場合でも、プランナーは同じ形式のデプロイマニフェスト(JSON)を出力します。
- このマニフェストは HTTPS で Amazon API Gateway の
POST /deployエンドポイントに送信されます。認証には Entra ID ベアラートークン(MSAL.js)が使用されます。プランナーの 2 つの経路がいずれも同じエンドポイントと契約に収束するため、ここからの処理はすべて共通となります。
- API Gateway は Deploy Lambda(プロビジョニングエージェント)を呼び出します。ここでは Entra JWT の検証(テナント情報と有効期限の確認)、アクセス制御モードの存在確認、およびアプリレジストリテーブルにおけるスラッグ所有権の原子チェックが行われます。
エージェントはワークロードを分類し、静的なアプリ(電卓やチャートなど)かフルスタック型(データ永続化が必要)かを判断して、適切なプロビジョニングパスを選択します。
静的なアプリの場合、エージェントは HTML を Entra 認証のシェルでラップアップし、Amazon S3 にアップロード。その後、Amazon CloudFront のキャッシュを無効化して、Amazon DynamoDB にアプリを登録します。
フルスタック型アプリの場合はさらに、アプリごとの DynamoDB テーブル、スコープ付き AWS IAM ロールを持つアプリごとの AWS Lambda 関数、そしてアプリごとの API Gateway をプロビジョニング。その後、新しい API URL をフロントエンドに注入してからラップアップしてアップロードします。
Microsoft 365 グループの作成など長時間かかるステップは、非同期自己呼び出し(asynchronous self-invocation)で処理されます。エージェントが自身の別コピーをバックグラウンドタスクとして起動することで、ユーザーのリクエストへの応答を迅速に返す仕組みです。
エンドユーザーは HTTPS を通じて CloudFront からライブアプリにアクセスします。CloudFront Function が .domain 拡張子を S3 内の正しいアプリへルーティングします。すべてのアプリは Entra のシングルサインオン(SSO)の背後にあり、Amazon CloudWatch で監視可能です。
プロビジョニングエージェントの仕組み
プロビジョニングエージェントは、ワークロードの分類と長時間かかるプロビジョニングステップのオーケストレーションという 2 つの中核機能を担っています。
ツール選択とワークロード分類
Deploy Lambda は、AWS SDK for JavaScript v3 と Microsoft Graph API をツールベルトとして活用します。マニフェストに基づき、どのツールを呼び出すか、そしてその順序を決定します。静的なアプリでは S3、CloudFront、DynamoDB レジストリのみが対象となります。フルスタック型アプリではこれに加えて DynamoDB と API Gateway が制御され、機能を持つアプリではさらに Lambda と IAM も扱います。アクセス制御は Microsoft Graph を経由して行われ、アプリ用の M365 グループの作成と管理を行います。この分類は決定論的であり、すべての処理がログに記録されます。同じマニフェストからは常に同一のプランが生成されます。
Lambda 内での長時間実行タスク
一部のプロビジョニング手順には、ユーザーが同期リクエストで待機するよりも長い時間がかかる場合があります。特に M365 グループ作成後のディレクトリ複製などが該当します。リクエストを接続したまま保持するのではなく、エージェントは非同期の自己呼び出しを利用します。具体的には、lambda:InvokeFunction を Event 呼び出しタイプで自身に対して呼び出し、即座にライブ URL を返してバックグラウンドでのコピー処理を完了させます。これはサーバーレス環境におけるエージェントの「バックグラウンドタスク」パターンに相当し、Lambda の実行制限範囲内で安全に動作します。
アプリごとのランタイム:デュアルティア計算モデル
すべてのアプリに個別の計算リソースが必要というわけではありません。多くのフルスタックアプリは、独自の DynamoDB テーブルに対する単純な CRUD(作成・読み取り・更新・削除)操作で構成されているため、共有されたプラットフォーム管理型の Lambda 上で動作します。これは、プロビジョニング済みコンカレンシーを備えた重み付きエイリアスによってフロントエンドが保護されており、多くのアプリに対して1つのウォーム化され監査済みのコードパスを提供するものです。また、自動的なカナリア展開とロールバックのガード機能も備えています。
アプリが独自の Lambda インスタンスへ昇格し、専用のスコープ付き IAM ロールを付与されるのは、マニフェストでクローズドな許可リスト(例えば、メール送信、特定の外部 HTTPS ドメインへの呼び出し、指定されたデータソースからの読み取りなど)から機能を宣言した場合に限られます。この昇格には管理者による承認ステップが必要です。承認プロセスは、提出されたコードの静的解析と、生成される IAM ロールのドリフト検出によって裏付けられています。
デフォルトのパスは共有され低コストです。一方、特権を付与されたパスはアプリごとに独立し、最小限の権限(least-privilege)で構成され、ゲート機能によって制御されています。
管理されたインアプリ AI
展開されたアプリでは、AI 機能への要望が高まっています。具体的には、レコードの要約、入力フォームの分類、アプリ内のデータに基づく質問応答などが挙げられます。
最も素朴なアプローチは、各アプリがモデルベンダーの SDK と API キーを埋め込むことです。しかしこれでは認証情報が散在し、中央集権的なガバナンスが機能しなくなり、コスト管理も不可能になります。
PDI Brew はこれとは対照的なアプローチを採用しています。AI をプラットフォーム機能として位置づけ、各アプリが個別に所有する統合ではなく、単一のエンドポイントを通じてアクセス可能にするのです。
すべての呼び出しにおいて、モデル実行前後に 3 つの制御が動作します。まず、必須の Amazon Bedrock Guardrail が、個人識別情報(PII)の削除、コンテンツフィルタリング、プロンプトインジェクション対策をすべての呼び出しで実施します。この機能はアプリ側で無効化できません。
次に、12 個のカウントからなるアトミックな予算管理が支出制限を強制します。Bedrock の呼び出し前に、単一の DynamoDB TransactWriteItems が、グローバル、アプリ、ユーザー、およびアプリとユーザーの組み合わせという 4 つのスコープにおいて、それぞれ日次・週次・月次の 3 つの時間窓にわたって支出を予約します。12 個のカウントのうちいずれかが上限を超えると、リクエストは即座に 429 Too Many Requests エラーで短絡され、どの制限がトリガーされたかを示す構造化されたレスポンスボディが返されます。これにより、バグや無限ループ、悪意のある利用によって発生するコストの暴走を、予測不能な請求書ではなく、管理可能で観測可能な事象として抑止します。
アプリ所有者は管理者からアプリスコープの予算引き上げを申請できますが、グローバル制限とユーザーごとの上限は所有者が拡張することはできません。さらに、2 段階の停止スイッチにより、管理者による無効化が常にアプリ所有者の有効化よりも優先され、プラットフォーム全体のフラグ一つで AI 機能をすべて停止できるため、プラットフォームチームはどのアプリにも依存しない強力な緊急停止機能を持っています。
すべての呼び出しは監査されます(UPN、アプリ名、使用モデル、トークン数、推定コスト、ガードレールの結果など)。これにより、支出と利用状況がエンドツーエンドで特定のアプリおよびユーザーに帰属可能となります。
セキュリティと最小権限の原則
エージェントがインフラをプロビジョニングするため、そのセキュリティモデルは設計において最も重要な要素となります。これにはいくつかの原則が適用されます。
IAM レイヤーにおける多層防御です。プロビジョニングエージェントはリソース作成に必要な広範な権限を持ちますが、エージェントが作成する各アプリ用の Lambda 関数は、独立したスコープ付きロールを継承します。このロールでアクセスできるのは pdi-brew-{env}-app- で始まる DynamoDB テーブルのみです。エージェントは、デプロイされたアプリが必要とする以上の権限を付与しないため、あるテナントのコードにバグがあっても、他のテナントのデータを参照することはできません。
すべてのパスにおけるアイデンティティ検証です。デプロイされたアプリへの認証不要なルートは存在しません。デプロイ API はプロビジョニング前に Entra JWT を検証し、生成されるすべてのアプリには MSAL.js による認証シェルが組み込まれています。このシェルは、各アクセス時に Microsoft Graph を通じてMicrosoft 365 グループのメンバーシップを確認します。
アイデンティティプロバイダに関する注記:本アーキテクチャでは、Amazon Cognito ではなく Microsoft Entra ID と MSAL.js を用いた認証を採用しています。これは PDI Technologies が持つ既存のエンタープライズ SSO(シングルサインオン)要件に基づく意図的な設計判断です。PDI の従業員はすでに Microsoft Entra ID を通じて認証済みであり、既存のアイデンティティプロバイダに直接統合することでエンドユーザーの摩擦を減らし、既存のセキュリティポリシーにも適合させることができました。もし組織側で特定のアイデンティティプロバイダへの優先事項がない場合は、AWS サービスとネイティブに統合され、同様の連合サインインフローをサポートする Amazon Cognito が代替手段として利用可能です。
AI のアクセス権限は、設計段階から最小権限の原則に基づいています。AI 用の Lambda ロールには、許可リストに登録されたモデル ARN にリソースを限定した bedrock:InvokeModel および InvokeModelWithResponseStream 権限のみが付与されており、アカウント内の他のリソースが Bedrock を呼び出すことはできません。Lambda 関数自体に Bedrock の権限はなく、AI へのアクセスはゲートウェイを経由した HTTPS 通信を通じてのみ行われます。このゲートウェイではガードレールと予算管理が適用されます。 (原文の技術表記: *)
追加された制御機能により、すべてのデプロイ済みアプリのセキュリティ体制が強化されています。Amazon S3 のパブリックアクセスは完全にブロックされ、CloudFront(Origin Access Control を経由)のみがオブジェクトの読み取りを許可されます。CloudFront は HTTPS へのリダイレクトと HSTS、そして厳格な Content-Security-Policy を適用しています。API Gateway ではデプロイエンドポイントに対してレート制限(持続 1 秒あたり 50 リクエスト、バースト 100)が設定されています。Amazon S3 のバージョニング機能と DynamoDB のポイントインタイムリカバリはデータ損失を防ぎ、破壊防止ライフサイクルルールがレジストリとバケットを保護します。
サーバーレスネイティブなマルチテナンシー
デプロイされるすべてのアプリがテナントとなり、アーキテクチャ上では各テナントに独自のサブドメイン(CloudFront Function によってルーティング)、必要に応じて独自の DynamoDB テーブル、そしてそのデータのみをスコープとした Lambda ロールが割り当てられます。計算リソースの共有はなく「ノイジー・ネイバー」リスクも存在しません。すべてのコンポーネントがサーバーレスであるため、アイドル時には各テナントが独立してスケールゼロになります。100 番目のアプリを追加しても、誰かが利用するまでは実質的なコストは発生しません。
オブザーバビリティ
プロビジョニングエージェントと各アプリ固有の Lambda 関数は、構造化された JSON ログを Amazon CloudWatch に記録します。PDIBrew ネームスペースのカスタムメトリクスでは、デプロイの実行状況、アプリの閲覧数、認証失敗、グループやリストの作成、そしてプロビジョニングのレイテンシを追跡しています。管理パネルはクエリを実行し...
原文を表示
Many enterprises have a long tail of internal tools that never get built. A team needs a shipping-cost calculator, a straightforward intake form, a small dashboard over a spreadsheet, but each one requires a developer, a backlog slot, and a deployment pipeline. The tools are too small to prioritize and too numerous to ignore.
PDI Technologies serves the convenience retail and petroleum wholesale industries, helping businesses around the globe increase efficiency and profitability by securely connecting their data and operations. PDI has 40 years of experience, a workforce of approximately 4,000 employees, and serves over 200,000 customer locations across more than 200 countries and territories. PDI recognized that traditional deployment pipelines were blocking non-technical teams from shipping the tools they needed.
To close that gap, PDI Technologies built PDI Brew. A non-technical employee describes the tool they want in plain English, and within seconds they receive a fully provisioned, multi-tenant web application, protected by single sign-on (SSO) and running on AWS. No Git, no terminals, and no DevOps knowledge required. The person who needs the tool is the person who ships it. Because every app inherits the same platform, each one can opt into a governed AI capability (chat, summarize, classify) backed by Amazon Bedrock. This occurs without its author ever touching a model endpoint or an API key.
In this post, we show how PDI Technologies built PDI Brew around an agentic provisioning pattern. A planning agent captures user intent as a structured manifest using a skill inside an AI assistant (for example, Claude, ChatGPT, or Claude Code) or as an Amazon Bedrock model invocation inside an AWS trust boundary. A provisioning agent running on AWS Lambda then decomposes that manifest, classifying the workload, selecting tools, and orchestrating the creation of every downstream AWS resource in one request. We then show how the same platform exposes in-app AI as a governed, least-privilege gateway to Amazon Bedrock. We describe the architecture, the security model, long-running provisioning steps inside Lambda, the AI guardrail-and-budget design, and the cost profile of running this system at scale.
Prerequisites
To understand this architecture, familiarity with the following AWS services is helpful: AWS Lambda, Amazon API Gateway, Amazon DynamoDB, Amazon Simple Storage Service (Amazon S3), Amazon CloudFront, and Amazon Bedrock. Experience with Microsoft Entra ID (formerly Azure AD) and MSAL.js is useful for the authentication sections. Verify you have the AWS Command Line Interface (AWS CLI) installed and configured with credentials that have sufficient permissions to create AWS Identity and Access Management (IAM) roles and policies if you plan to implement a similar pattern in your own environment.
Challenges with internal tools
Traditional internal-tool delivery couples a straightforward business need to a full software delivery lifecycle. Even a single-page calculator inherits the cost of a repository, a build pipeline, an authentication integration, a hosting decision, a TLS certificate, DNS, logging, and ongoing maintenance. The result is a permanent queue of small tools that are always deprioritized behind revenue-generating features.
We wanted a system with four properties:
- Intent in, application out. The requester describes the tool. The platform provisions it. No handoff to engineering.
- Secure and governed by default. Every app inherits enterprise SSO, scoped IAM, HTTPS, and centralized observability. There is no “insecure” path.
- Serverless and scale-to-zero. Hundreds of small apps must cost almost nothing when idle, with no shared servers to patch or capacity to plan.
- AI without a free-for-all. Apps can use generative AI, but only through a controlled path with guardrails, quotas, and a full audit trail. Never by embedding their own model keys.
Solution overview
“Agentic” does not need to mean “a large language model in the request path for every decision.” We define an agent as a system that takes a goal, decomposes it, selects tools, and acts toward that goal. PDI Brew separates the two halves of that definition into two agents with very different trust profiles.
The planning agent captures intent. It interviews the user, helps them refine what they want, generates the application front end, and critically emits a structured deploy manifest: a JSON description of the user’s intent (app name, type, data schema, and access-control settings). The planning logic is packaged as the Vibe App Builder skill, which runs inside whatever AI assistant the employee already uses. Running the planner in the assistant gives users a rich conversational experience in a tool they already have open and keeps the surface area on the AWS side small.
The provisioning agent is an AWS Lambda function. It receives the manifest and acts as a deterministic, auditable, tool-using orchestrator. It validates the request, classifies the workload, and chooses a provisioning path. It then calls AWS and Microsoft Graph APIs as tools, handles long-running steps through asynchronous self-invocation, and returns a live URL. Putting the provisioning logic in Lambda rather than in a chat session is deliberate: provisioning is exactly the kind of workload where every decision must be logged, reproducible, and free of hallucination.
A pluggable planner: bring your own assistant
Intent can come from anywhere, so the planner is designed as a pluggable layer with two interchangeable paths. A single environment variable (PLANNER_MODE) selects which one is active, and both paths emit the identical deploy manifest, so everything downstream is unchanged.
Path A — the Vibe Skill in any AI assistant. The Vibe App Builder skill (hereafter, the Vibe Skill) packages the planning logic and runs inside whatever AI assistant the employee already uses. The assistant interviews the user, generates the front end, and produces the manifest. The planner runs outside AWS, which gives users a rich conversational experience in a tool they already have open.
Path B — Amazon Bedrock inside the AWS trust boundary. For channels like Teams, a web form, or an IDE, the request is sent to Amazon Bedrock. A Bedrock model invocation (InvokeModel) acts as the planner: it classifies the workload, emits the same manifest, and can validate or repair the data schema before provisioning. This path operates entirely inside AWS, so every decision is captured in AWS CloudTrail and tied to a model-invocation ID, and no intent data leaves the AWS boundary. This is important for teams with strict data-residency requirements.
One contract, one provisioning agent. Because both planners emit the same manifest JSON, the provisioning agent on Lambda and the entire per-app runtime are identical regardless of path. Adding the Bedrock path was an additive change, not a rewrite. And PLANNER_MODE can be pinned per organization, workspace, or user, so one enterprise can require the Bedrock path while another keeps the in-assistant experience. It also leaves a clean forward path: the Bedrock invocation can later be replaced with a richer managed agent runtime without touching Path A or the provisioning agent.
Architecture
The following diagram illustrates the end-to-end architecture. It has three layers: a pluggable intent and planning layer, a unified agentic provisioning runtime, and a per-app runtime, supported by shared edge, identity, and observability services.

The following walkthrough traces a request through each layer:
- In the intent and planning layer, an employee describes the tool in plain English. Depending on PLANNER_MODE, the planner is either the Vibe Skill running in their assistant (Path A) or an Amazon Bedrock invocation behind a channel like Slack or Teams (Path B). Either way, the planner emits the same deploy manifest as JSON.
- The manifest is sent over HTTPS to POST /deploy on Amazon API Gateway, authenticated with an Entra ID bearer token (MSAL.js). Because both planner paths converge on the same endpoint and contract, everything from here on is identical.
- API Gateway invokes the Deploy Lambda (the provisioning agent). It validates the Entra JWT (tenant and expiry), enforces that an access-control mode is present, and atomically checks slug ownership in the app registry table.
- The agent classifies the workload (static (a calculator or chart), full-stack (needs data persistence) and selects the matching provisioning path.
- For a static app, the agent wraps the HTML in an Entra authentication shell, uploads it to Amazon S3, invalidates the Amazon CloudFront cache, and registers the app in Amazon DynamoDB.
- For a full-stack app, the agent additionally provisions a per-app DynamoDB table, a per-app AWS Lambda function with a scoped AWS IAM role, and a per-app API Gateway. It then injects the new API URL into the front end before wrapping and uploading it.
- Long-running steps (creating a Microsoft 365 group) are handled by asynchronous self-invocation: the agent invokes a second copy of itself as a background task so the user’s request returns quickly.
- End users reach the live app over HTTPS through CloudFront, where a CloudFront Function routes .domain to the correct app in S3. Every app sits behind Entra single sign-on and is observable in Amazon CloudWatch.
How the provisioning agent works
The provisioning agent performs two core functions: classifying workloads and orchestrating long-running provisioning steps.
Tool selection and workload classification
The Deploy Lambda treats the AWS SDK for JavaScript v3 and the Microsoft Graph API as its tool belt. Based on the manifest, it decides which tools to call and in what order. A static app touches only S3, CloudFront, and the DynamoDB registry. A full-stack app additionally drives DynamoDB and API Gateway, and, for capability-bearing apps, Lambda and IAM. Access control reaches into Microsoft Graph to create and manage the app’s M365 group. The classification is deterministic and fully logged: the same manifest always produces the same plan.
Long-running work inside Lambda
Some provisioning steps take longer than a user wants to wait on a synchronous request, notably directory propagation after creating an M365 group. Rather than hold the request open, the agent uses asynchronous self-invocation: it calls lambda:InvokeFunction on itself with an Event invocation type, returns the live URL immediately, and lets the background copy finish the slow work. This is the serverless equivalent of an agent’s “background task” pattern, kept comfortably inside the Lambda execution envelope.
Per-app runtime: a dual-tier compute model
Not every app needs its own compute. Most full-stack apps are straightforward create, read, update, and delete (CRUD) operations over their own DynamoDB table, so they run on a shared, platform-managed CRUD Lambda fronted by a weighted alias with provisioned concurrency. This provides one warm, audited code path serving many apps, with an automatic canary-rollback guard. An app graduates to its own per-app Lambda with a dedicated, scoped IAM role only when its manifest declares a capability from a closed allowlist (for example, sending email, calling a specific external HTTPS domain, or reading from a designated data source). This graduation requires an admin approval step. The approval is backed by static analysis of the submitted code and drift detection on the resulting IAM role. The default path is shared and cheap. The privileged path is per-app, least-privilege, and gated.
Governed in-app AI
Deployed apps increasingly want AI features: summarize a record, classify an intake form, answer a question over the app’s data. The naive path is for each app to embed a model vendor’s SDK and an API key. This scatters credentials, defeats central governance, and makes spend impossible to control. PDI Brew takes the opposite approach: AI is a platform capability reached through one endpoint, not an integration each app owns.
Three controls run on every call, before and after the model. First, a mandatory Amazon Bedrock Guardrail handles personally identifiable information (PII) redaction, content filtering, and prompt-injection defense on every invocation. The app cannot turn this off. Second, a 12-counter atomic budget enforces spend limits. Before any Bedrock call, a single DynamoDB TransactWriteItems reserves spend across four scopes (global, app, user, and app-user), each over three windows (daily, weekly, monthly). A breach in any of the twelve counters short-circuits the request with 429 Too Many Requests and a structured body naming the limit that fired. This makes runaway cost, whether from a bug, a loop, or abuse, a bounded, observable event rather than a surprise invoice. App owners can be granted higher app-scoped budgets by an admin. The global and per-user ceilings cannot be widened by owners. Third, a two-tier terminate switch allows an admin disable always beats an owner enable, and a single platform-wide flag can disable AI everywhere, so the platform team retains a hard stop-switch independent of any app.
Every call is audited (UPN, app, model, token counts, estimated cost, and guardrail outcome), so spend and usage are attributable to an app and a user, end to end.
Security and least privilege
Because the agent provisions infrastructure, its security model is the most important part of the design. Several principles govern it.
Defense in depth at the IAM layer. The provisioning agent holds the broad permissions it needs to create resources. But the per-app Lambda functions it creates inherit a separate, scoped role that can reach only DynamoDB tables prefixed with pdi-brew-{env}-app-. The agent never grants a deployed app more privilege than that app needs, so a bug in one tenant’s code cannot read another tenant’s data.
Identity on every path. There is no unauthenticated route to a deployed app. The deploy API validates an Entra JWT before provisioning, and every generated app is wrapped in an MSAL.js authentication shell that checks Microsoft 365 group membership through Microsoft Graph on each visit.
*Note on identity provider: this architecture uses Microsoft Entra ID with MSAL.js for authentication rather than Amazon Cognito. This is a deliberate design choice driven by PDI Technologies’ existing enterprise SSO requirements. PDI’s workforce already authenticates through Microsoft Entra ID. Integrating directly with their established identity provider reduced friction for end users and aligned with existing security policies. For organizations without an existing identity provider preference, Amazon Cognito offers an alternative that integrates natively with AWS services and supports similar federated sign-in flows.*
AI is least-privilege by construction. The AI Lambda role grants bedrock:InvokeModel and InvokeModelWithResponseStream scoped by resource to the allow-listed model ARNs (not *), and nothing else in the account can call Bedrock. Lambda functions have no Bedrock permission and reach AI only over HTTPS through the gateway, where guardrails and budgets apply.
Additional controls reinforce the security posture across every deployed app. Amazon S3 public access is fully blocked. Only CloudFront (through Origin Access Control) can read objects. CloudFront enforces redirect-to-HTTPS with HSTS and a strict Content-Security-Policy. API Gateway rate-limits the deploy endpoint (50 requests per second sustained, 100 burst). Amazon S3 versioning and DynamoDB point-in-time recovery protect against data loss, and prevent-destroy lifecycle rules guard the registry and bucket.
Serverless-native multi-tenancy
Every deployed app is a tenant, and the architecture gives each tenant its own subdomain (routed by a CloudFront Function), its own DynamoDB table where applicable, and a Lambda role scoped to its own data. There is no shared compute and no noisy-neighbor risk, and because every component is serverless, each tenant scales to zero independently when idle. Adding the hundredth app costs essentially nothing until someone uses it.
Observability
The provisioning agent and every per-app Lambda function write structured JSON logs to Amazon CloudWatch. Custom metrics in the PDIBrew namespace track deploys, app views, authentication failures, group and list creation, and provisioning latency. An admin panel quer
関連記事
今日のまとめ
AIデイリーブリーフで今日の重要ニュースをまとめ読み