Skip to content

leomaro7/aws-solution-agent

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AWS Solution Agent

AWS Bedrock AgentCore を活用した、ソリューション提案・構成図生成・見積もり計算エージェント。

概要

3 つの MCP (Model Context Protocol) Server と連携し、AWS ソリューションの提案を統合的に行います。

MCP Server 機能 接続方式
AWS Knowledge MCP Server ベストプラクティス取得 Remote MCP (Streamable HTTP)
AWS Diagram MCP Server 構成図生成 Lambda ラップ (stdio)
AWS Pricing MCP Server 見積もり計算 Lambda ラップ (stdio)

アーキテクチャ

オンプレミス
  │ Direct Connect
  ▼
┌─────────────────────────────────────────────────────────┐
│ VPC (Private Isolated Subnet x 2AZ)                     │
│                                                         │
│  ECS Express Mode (CfnExpressGatewayService)            │
│  ┌─────────────────────────────────────────┐            │
│  │ ALB (自動管理) ──► Streamlit (8501)     │            │
│  │ Auto Scaling / TG / SG / CW Logs 自動管理│            │
│  └─────────────────────────────────────────┘            │
│                         │                               │
│                    VPC Endpoint                          │
│                    (bedrock-agentcore)                   │
│                         │                               │
│              ┌──────────▼──────────┐                    │
│              │ AgentCore Runtime   │                    │
│              │ (Direct Code Deploy)│                    │
│              └──────────┬──────────┘                    │
│                         │ AWS 内部ネットワーク          │
│              ┌──────────▼──────────┐                    │
│              │ AgentCore Gateway   │                    │
│              │ (MCP + Semantic)    │                    │
│              └──┬────┬────┬───────┘                    │
│                 │    │    │                              │
│     ┌───────┐  │  ┌─▼──┐ │  ┌────────┐                │
│     │Lambda │  │  │Lamb│ │  │Remote  │                │
│     │Diagram│◄─┘  │Pric│ └─►│AWS     │                │
│     │MCP    │     │MCP │    │Knowledge│               │
│     └───────┘     └────┘    └────────┘                │
└─────────────────────────────────────────────────────────┘

ディレクトリ構成

aws-solution-agent/
├── agent/                  # Strands Agent (BedrockAgentCoreApp)
│   ├── main.py             # エントリポイント
│   ├── system_prompt.py    # システムプロンプト
│   ├── requirements.txt
│   └── build.sh            # arm64 zip ビルド
├── frontend/               # Streamlit チャット UI
│   ├── app.py
│   ├── agent_client.py     # InvokeAgentRuntime クライアント
│   ├── requirements.txt
│   └── Dockerfile
├── lambda/                 # Lambda MCP ラッパー
│   ├── diagram-mcp-wrapper/
│   └── pricing-mcp-wrapper/
├── infra/                  # CDK TypeScript (4 スタック)
│   ├── bin/app.ts
│   └── lib/
│       ├── network-stack.ts     # VPC, Endpoints, SG
│       ├── mcp-server-stack.ts  # Gateway, Lambda, Remote MCP
│       ├── agent-stack.ts       # Runtime, Memory
│       └── frontend-stack.ts    # ECS Express Mode
├── tests/
│   ├── conftest.py
│   └── test_agent_local.py
└── docs/
    ├── aws-solution-agent-plan.md
    └── aws-solution-agent-architecture.drawio

前提条件

  • Node.js >= 18
  • Python >= 3.12
  • AWS CDK CLI (npm install -g aws-cdk)
  • AWS 認証情報(aws configure 設定済み)
  • Docker(Lambda バンドリングおよびフロントエンドコンテナビルド用)

セットアップ

1. CDK 依存関係のインストール

cd infra
npm install

2. Lambda 依存関係のインストール

デプロイ前に各 Lambda ラッパーの依存関係をインストールします。

cd lambda/diagram-mcp-wrapper
pip install -t . -r requirements.txt

cd ../pricing-mcp-wrapper
pip install -t . -r requirements.txt

3. CloudFormation テンプレートの生成確認

cd infra
npx cdk synth

4 つのスタックのテンプレートが生成されます:

  • AwsSolutionAgent-Network
  • AwsSolutionAgent-McpServer
  • AwsSolutionAgent-Agent
  • AwsSolutionAgent-Frontend

デプロイ

cd infra
npx cdk deploy --all

スタックは依存順(Network → McpServer → Agent → Frontend)で自動デプロイされます。

テスト

ユニットテスト

pip install pytest
pytest tests/ -v

ローカル動作確認

エージェント(Runtime 未接続)

cd agent
pip install -r requirements.txt
python main.py
# http://localhost:8080/ping でヘルスチェック

フロントエンド(Runtime 未接続)

cd frontend
pip install -r requirements.txt
streamlit run app.py
# http://localhost:8501 でUI表示確認

設計方針

セキュリティ

  • 閉域ネットワーク(NAT Gateway なし、PRIVATE_ISOLATED サブネット)
  • VPC Endpoint 経由の AWS サービスアクセス
  • IAM 認証(Runtime / Gateway)
  • 最小権限の IAM ポリシー

AgentCore 構成

  • Runtime: Direct Code Deploy (S3 zip) + VPC 配置
  • Memory: STM のみ、7 日有効期限
  • Gateway: MCP プロトコル + Semantic 検索有効

フロントエンド

  • ECS Express Mode (CfnExpressGatewayService): ALB / TG / Auto Scaling / CW Logs を自動管理
  • networkConfiguration にプライベートサブネットを指定し、内部 ALB として動作
  • Streamlit: ポート 8501、ストリーミング応答対応
  • Direct Connect 経由でオンプレミスユーザーからアクセス

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors