4Aモデル(AI Agent Application Architecture)は、LLMベースのAIエージェントアプリケーションを迅速かつ拡張性高く構築するためのリファレンスアーキテクチャです。以下の6つのレイヤーで構成され、エンタープライズ用途に対応可能なセキュリティ・柔軟性・観測性を備えています:

User Interface Layer
Gateway Layer
Orchestrator / Reasoning Layer
MCP Server / Tool Layer
Data / API Layer
Context / Memory Layer
1. 🖥 User Interface Layer(UI 層)
項目 | 処理概要(JP / EN) | 技術スタック |
Web UI |
ユーザーが自然言語入力や操作を行うためのチャット/操作画面。Chat or interface screen for user input via natural language. |
React / Next.js / TailwindCSS |
Native App |
モバイルユーザー向けのネイティブインターフェース。Native interface for mobile users. |
Flutter / React Native |
WebAPI Entry |
UI からの HTTP リクエストの入り口。Entry point for HTTP requests from UI. |
FastAPI / Express / API Gateway |
Chat UI |
チャットベースの対話型ユーザーインターフェース。Interactive chat-based interface for LLM communication. |
Streamlit / ChatGPT Plugin UI |
MCP Client |
MCP規格に対応したクライアント。Client supporting the MCP protocol to call tools or agents. |
Python SDK / gRPC Stub / OpenAPI Client |
2. 🛡 Gateway Layer(ゲートウェイ層)
項目 |
処理概要(JP / EN) |
技術スタック |
認証(Auth) |
ユーザーやアプリの身元を確認し、セッションを開始。Authenticate users or apps and start sessions. |
OAuth2 / JWT / Firebase Auth / Cognito |
アクセス制御(Access Control) |
ユーザーごとの操作許可を制御。Enforces user-level access permissions. |
OPA / Casbin / Custom RBAC |
Rate Limiter |
リクエスト頻度を制限し、不正利用を防ぐ。Prevents abuse by throttling request rates. |
Redis + Lua / Kong Gateway / Envoy |
Policy Routing |
リクエスト種別や条件に応じたルーティング。Route requests based on type or rules. |
Spring Cloud Gateway / Envoy |
リクエスト検証 |
リクエストの構造や値を検査。Validate request schema and input. |
JSON Schema / Zod / Pydantic |
3. 🤖 Orchestrator / Reasoning Layer(推論・制御層)
項目 |
処理概要(JP / EN) |
技術スタック |
Planner / ReAct |
タスク計画・ReAct戦略による推論制御。Task planning and reasoning using ReAct or Tree of Thought. |
LangGraph / AutoGen / CrewAI |
Task Router |
タスクの種類や優先度によって適切な経路へ転送。Route tasks to appropriate logic/agents. |
Celery / Temporal / Prefect |
Task Coordinator |
タスク状態と進行の制御。Manages task progress and orchestration. |
Async Queue / LangChain Runnable |
Memory / Context Manager |
会話履歴や中間データのI/Oを仲介。Handles I/O with memory layer. |
LangChain Memory / Redis |
Reasoning LLM |
実際に推論・出力を生成する大規模言語モデル。LLM that performs inference and generates output. |
GPT-4o / Claude / Mistral |
Agent Collaborator |
マルチエージェントの連携を管理。Handles multi-agent coordination. |
AutoGen / CrewAI / SwarmAgent |
Agent Identity Registry |
エージェントのプロファイル・属性を管理。Manages metadata and identities of agents. |
Redis / Metadata DB |
Prompt Store |
プロンプトテンプレート管理・バージョン管理。Stores prompt templates and versions. |
PostgreSQL / DynamoDB |
Policy Engine |
エージェント動作や許可のルール制御。Policy enforcement on agent behavior. |
OPA / YAML Rules |
4. 🛠 MCP Server / Tool Layer(ツール実行・接続層)
項目 |
処理概要(JP / EN) |
技術スタック |
MCP Registry |
MCPツールの定義とスキーマ管理。Defines and manages schemas for tools. |
JSON-RPC Manifest / Redis |
Tool Adapter |
外部サービスやローカルスクリプトを統一化。Adapters for APIs or scripts into unified interface. |
FastAPI / LangChain Tool |
Tool Executor |
MCPクライアントの指示に従い実行。Executes tasks based on MCP requests. |
Celery Worker / Subprocess |
API Connector |
外部APIをツールとして呼び出し可能に。Exposes external APIs as callable tools. |
OpenAPI / LangChain API Tool |
JSON-RPC Server |
MCP対応のRPCプロトコル実行基盤。RPC server compatible with MCP protocol. |
FastAPI / Express |
5. 🗃 Data / API Layer(データ・API層)
項目 |
処理概要(JP / EN) |
技術スタック |
API Server |
データベースや業務ロジックの呼び出し口。Interfaces to business logic and data sources. |
FastAPI / GraphQL / REST |
DBMS |
永続データの保存・検索。Persistent data storage and retrieval. |
PostgreSQL / MySQL / SQLite |
Vector Store |
類似検索・長期記憶を実現。Stores embeddings for similarity and memory. |
Weaviate / Qdrant / Pinecone |
Message Queue |
イベントや非同期処理のメッセージ基盤。Asynchronous task/event messaging. |
Kafka / RabbitMQ / Redis Stream |
Runtime Script |
計算・処理用のスクリプト群。Custom executable logic or scripts. |
Python / LangSmith / Node.js |
6. 🧠 Context / Memory Layer(記憶・文脈層)
項目 |
処理概要(JP / EN) |
技術スタック |
Logs |
処理履歴やユーザー行動の記録。Logs for processing and user behavior. |
Loki / CloudWatch / ELK Stack |
Cache |
応答やデータの一時保存。Temporary cache for responses or lookups. |
Redis / Memcached |
Audit |
監査・トレーサビリティ記録。Auditable logs for agent behavior. |
PostgreSQL / GCP Audit / CloudTrail |
Long-term Memory |
会話・知識の長期保存と検索。Stores long-term conversational memory. |
Pinecone + SQL / Weaviate + Metadata |
Comments