A2A + MCP ブリッジパターン
エージェント上級
エージェント間通信はA2A、ツール連携はMCPに分離し、大規模運用での拡張性を高めます。
A2AMCPマルチエージェント相互運用
パターンコード
# A2A + MCP Bridge Architecture
## Overview
Agent-to-Agent (A2A) handles **inter-agent communication**
MCP handles **agent-to-tool communication**
```
┌─────────────────────────────────────────┐
│ Orchestrator │
│ (A2A Client + MCP Host) │
└──────┬──────────┬──────────┬────────────┘
│ A2A │ A2A │ A2A
▼ ▼ ▼
┌──────────┐ ┌──────────┐ ┌──────────┐
│ Research │ │ Coding │ │ Review │
│ Agent │ │ Agent │ │ Agent │
│ (Remote) │ │ (Local) │ │ (Remote) │
└────┬─────┘ └────┬─────┘ └────┬─────┘
│ MCP │ MCP │ MCP
▼ ▼ ▼
┌─────────┐ ┌─────────┐ ┌─────────┐
│ Web │ │ GitHub │ │ Sentry │
│ Search │ │ MCP │ │ MCP │
│ MCP │ │ Server │ │ Server │
└─────────┘ └─────────┘ └─────────┘
```
## Agent Card (A2A Discovery)
```json
{
"name": "coding-agent",
"description": "Implements code changes per specification",
"url": "https://agents.example.com/coding",
"capabilities": {
"streaming": true,
"pushNotifications": true
},
"skills": [
{ "id": "implement", "name": "Code Implementation" },
{ "id": "refactor", "name": "Code Refactoring" }
],
"mcpServers": [
{ "name": "github", "transport": "stdio" },
{ "name": "postgres", "transport": "streamable-http" }
]
}
```
## Orchestration Flow
```typescript
// 1. Discover available agents via A2A
const agents = await a2aClient.discover();
// 2. Create task for research agent
const researchTask = await a2aClient.createTask(
agents.find(a => a.skills.includes('research')),
{ message: "Research best practices for auth middleware" }
);
// 3. Wait for research, then delegate to coding agent
const researchResult = await a2aClient.waitForTask(researchTask.id);
const codingTask = await a2aClient.createTask(
agents.find(a => a.skills.includes('implement')),
{
message: "Implement auth middleware based on research",
context: researchResult.artifacts
}
);
// 4. Each agent uses MCP internally for tool access
// coding-agent → GitHub MCP (create branch, commit)
// coding-agent → PostgreSQL MCP (check schema)
// review-agent → Sentry MCP (check error patterns)
```
## Key Design Principles
1. **A2A for delegation**: agents don't call each other's tools directly
2. **MCP for tools**: each agent manages its own MCP connections
3. **Agent Cards for discovery**: no hardcoded agent endpoints
4. **Task lifecycle via A2A**: submitted → working → completed/failed
このパターンをプロジェクト設定にコピーして適用してください。
実行プレビュー
A2A + MCP ブリッジパターン
A2A + MCP ブリッジパターンについて
Claude Codeパターンは、複雑な開発シナリオに対応するための実証済みアーキテクチャ設計とワークフロー構造です。A2A + MCP ブリッジパターンは上級レベルのエージェントパターンで、プロジェクトに合わせて応用できるテスト済みの再現可能なアプローチを提供し、より効率的で一貫した成果を実現します。