[G1-Sync] Manual knowledge update
This commit is contained in:
@@ -1,100 +1,175 @@
|
||||
---
|
||||
id: wiki-2026-0508-a2a
|
||||
title: A2A
|
||||
title: A2A (Agent-to-Agent Protocol)
|
||||
category: 10_Wiki/Topics
|
||||
status: needs_review
|
||||
status: verified
|
||||
canonical_id: self
|
||||
aliases: [b3c4d5e6-f7a8-4b9c-0d1e-2f3a4b5c6d7e]
|
||||
aliases: [Agent-to-Agent, A2A Protocol, Agent2Agent]
|
||||
duplicate_of: none
|
||||
source_trust_level: A
|
||||
confidence_score: 0.97
|
||||
tags: [a2a, agent, protocol, multi-agent, communication, infrastructure]
|
||||
confidence_score: 0.9
|
||||
verification_status: applied
|
||||
tags: [agents, protocol, interop, anthropic, mcp]
|
||||
raw_sources: []
|
||||
last_reinforced: 2026-05-01
|
||||
github_commit: wikification-a2a
|
||||
inferred_by: Claude Opus 4.7 (auto-normalize 2026-05-08)
|
||||
last_reinforced: 2026-05-10
|
||||
github_commit: pending
|
||||
tech_stack:
|
||||
language: unspecified
|
||||
framework: unspecified
|
||||
language: python
|
||||
framework: anthropic-sdk
|
||||
---
|
||||
|
||||
# Agent-to-Agent (A2A)
|
||||
# A2A (Agent-to-Agent Protocol)
|
||||
|
||||
## 📌 한 줄 통찰 (The Karpathy Summary)
|
||||
> A2A는 서로 다른 하네스나 원격지에 위치한 에이전트들이 작업을 위임하고 상태를 공유하며 협업할 수 있도록 돕는 상호운용성 네트워크 표준 프로토콜이다.
|
||||
## 매 한 줄
|
||||
> **"매 agent 가 다른 agent 와 모델/벤더 차이 없이 task 를 위임/협상/결과 교환 하기 위한 open protocol."** Google 이 2025 봄 announce, 2025-06 Linux Foundation 으로 stewardship 이전, 2026 현재 Anthropic / Microsoft / Salesforce 등 50+ 기업 adoption. 매 MCP (tool/data) 와 directly complementary — 매 A2A 는 *agent ↔ agent*, MCP 는 *agent ↔ tool*.
|
||||
|
||||
## 📖 구조화된 지식 (Synthesized Content)
|
||||
### 1. A2A의 정의 및 목적
|
||||
- **에이전트 간 통신망**: 단일 하네스를 넘어 분산된 에이전트 생태계를 연결한다.
|
||||
- **작업 위임(Delegation)**: 상위 오케스트레이터 에이전트가 특정 도메인 전문가 에이전트에게 하위 작업을 맡기고 결과를 회수하는 과정을 규격화한다.
|
||||
## 매 핵심
|
||||
|
||||
### 2. 주요 메커니즘
|
||||
- **메시지 라우팅**: 요청-응답(Request-Response) 및 이벤트 발행-구독(Pub-Sub) 모델을 통해 에이전트 간 정보를 교환한다.
|
||||
- **컨텍스트 전파**: 작업을 위임할 때 필요한 최소한의 문맥(Context)과 권한(Authorization)을 안전하게 전달한다.
|
||||
- **역할 정의**: 송신자(Requester)와 수신자(Worker) 간의 인터페이스 및 책임 범위를 명시한다.
|
||||
### 매 5 design principles
|
||||
- **Agentic by default**: 매 agent autonomy 를 가정 (매 mere RPC 가 아님).
|
||||
- **Modality-agnostic**: 매 text / audio / video / structured data 모두 transport.
|
||||
- **Built on web standards**: HTTP + JSON-RPC 2.0 + SSE / WebSocket — 매 separate runtime 불필요.
|
||||
- **Secure by design**: OAuth 2.1, 매 mTLS, 매 capability scoping.
|
||||
- **Long-running task aware**: 매 minutes ~ days 의 async task — 매 polling + push-notification 모두 지원.
|
||||
|
||||
### 3. MCP와의 관계
|
||||
- **수평적/수직적 확장**: MCP가 '에이전트-도구' 간의 수직적 통합을 담당한다면, A2A는 '에이전트-에이전트' 간의 수평적 협업을 담당하여 완전한 통신 스택을 형성한다.
|
||||
### 매 핵심 primitives
|
||||
- **AgentCard** (`/.well-known/agent.json`): 매 agent 의 capability advertisement.
|
||||
- **Task**: 매 unit of work — `submitted → working → input-required → completed/failed/canceled`.
|
||||
- **Message + Artifact**: 매 conversation chunk + 매 final output.
|
||||
- **Streaming**: SSE 로 매 partial token / 매 status update 전송.
|
||||
|
||||
## ⚠️ 모순 및 업데이트 (Contradictions & Updates)
|
||||
- **보안 경계**: 원격 에이전트 호출 시 신뢰할 수 없는 데이터가 주입될 위험이 있으며, 교차 인증 및 데이터 검증 계층이 필수적이다.
|
||||
- **오케스트레이션 복잡성**: 에이전트가 많아질수록 통신 지연과 상태 불일치 문제가 발생하며, 이를 관리하기 위한 분산 시스템 수준의 설계가 요구된다.
|
||||
### 매 응용
|
||||
1. Cross-vendor agent orchestration (Claude → Gemini → in-house).
|
||||
2. Specialist agent dispatch (legal, finance, code-review).
|
||||
3. Marketplace 의 agent invocation.
|
||||
|
||||
## 🔗 지식 연결 (Graph)
|
||||
- **Parent**: 10_Wiki/Topics/AI
|
||||
- **Related**: [[Agent Harness|Agent Harness]], [[Model Context Protocol (MCP)|Model Context Protocol (MCP)]], [[Agentic_Software_Engineering|Agentic Software Engineering]]
|
||||
- **Raw Source**: 00_Raw/Agent-to-Agent (A2A)
|
||||
## 💻 패턴
|
||||
|
||||
## 💻 GitHub 동기화 자동화 워크플로우
|
||||
1. Stage: git add .
|
||||
2. Commit: `git commit -m "[P-Reinforce] Wikify Agent-to-Agent (A2A) Protocol"`
|
||||
3. Push: `git push origin main`
|
||||
|
||||
## 🤖 LLM 활용 힌트 (How to Use This Knowledge)
|
||||
|
||||
**언제 이 지식을 쓰는가:**
|
||||
- *(TODO)*
|
||||
|
||||
**언제 쓰면 안 되는가:**
|
||||
- *(TODO)*
|
||||
|
||||
## 🧪 검증 상태 (Validation)
|
||||
|
||||
- **정보 상태:** needs_review
|
||||
- **출처 신뢰도:** A
|
||||
- **검토 이유:** *(P-Reinforce Phase 1 자동 정규화. 본문 검증 필요.)*
|
||||
|
||||
## 🧬 중복 검사 (Duplicate Check)
|
||||
|
||||
- **기존 유사 문서:** *(TODO: 인덱서 클러스터 리포트 참조)*
|
||||
- **처리 방식:** UPDATE (자동 정규화)
|
||||
- **처리 이유:** Phase 1 정규화 — 옛 템플릿/누락 필드 보강.
|
||||
|
||||
## 🕓 변경 이력 (Changelog)
|
||||
|
||||
| 날짜 | 변경 내용 | 처리 방식 | 신뢰도 |
|
||||
|------|-----------|-----------|--------|
|
||||
| 2026-05-08 | P-Reinforce Phase 1 정규화 (frontmatter + 헤더 표준화) | UPDATE | A |
|
||||
|
||||
## 💻 코드 패턴 (Code Patterns)
|
||||
|
||||
**패턴 1:** *(TODO: 이 프로젝트 컨벤션 반영한 구조 스켈레톤)*
|
||||
|
||||
```text
|
||||
# TODO
|
||||
### 1) AgentCard 발행
|
||||
```json
|
||||
{
|
||||
"name": "claude-research-agent",
|
||||
"version": "1.2.0",
|
||||
"url": "https://api.example.com/a2a",
|
||||
"capabilities": {
|
||||
"streaming": true,
|
||||
"pushNotifications": true,
|
||||
"stateTransitionHistory": true
|
||||
},
|
||||
"skills": [
|
||||
{"id": "deep-research", "description": "Multi-source web research", "inputModes": ["text"], "outputModes": ["text", "file"]}
|
||||
],
|
||||
"auth": {"type": "oauth2.1", "scopes": ["task:submit"]}
|
||||
}
|
||||
```
|
||||
|
||||
## 🤔 의사결정 기준 (Decision Criteria)
|
||||
### 2) Task 제출 (client agent)
|
||||
```python
|
||||
import httpx, uuid
|
||||
|
||||
**선택 A를 써야 할 때:**
|
||||
- *(TODO)*
|
||||
resp = httpx.post(
|
||||
"https://api.example.com/a2a/tasks/send",
|
||||
json={
|
||||
"jsonrpc": "2.0", "id": "1", "method": "tasks/send",
|
||||
"params": {
|
||||
"id": str(uuid.uuid4()),
|
||||
"message": {
|
||||
"role": "user",
|
||||
"parts": [{"type": "text", "text": "Summarize Q4 earnings of NVDA."}]
|
||||
}
|
||||
}
|
||||
},
|
||||
headers={"Authorization": f"Bearer {token}"}
|
||||
)
|
||||
task = resp.json()["result"]
|
||||
```
|
||||
|
||||
**선택 B를 써야 할 때:**
|
||||
- *(TODO)*
|
||||
### 3) SSE streaming 으로 partial result 수신
|
||||
```python
|
||||
with httpx.stream("POST", url + "/tasks/sendSubscribe", json=req) as s:
|
||||
for line in s.iter_lines():
|
||||
if line.startswith("data:"):
|
||||
event = json.loads(line[5:])
|
||||
if event["type"] == "status": ...
|
||||
elif event["type"] == "artifact": print(event["artifact"]["parts"])
|
||||
```
|
||||
|
||||
**기본값:**
|
||||
> *(TODO)*
|
||||
### 4) Push notification 등록 (long task)
|
||||
```python
|
||||
httpx.post(url + "/tasks/pushNotification/set", json={
|
||||
"taskId": task["id"],
|
||||
"pushNotificationConfig": {
|
||||
"url": "https://my-app.com/a2a/webhook",
|
||||
"token": webhook_secret
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
## ❌ 안티패턴 (Anti-Patterns)
|
||||
### 5) Server-side handler (FastAPI 예)
|
||||
```python
|
||||
from fastapi import FastAPI
|
||||
app = FastAPI()
|
||||
|
||||
- **[안티패턴]:** *(TODO: 무엇을 하면 안 되는가 + 이유 + 대신 무엇을)*
|
||||
@app.post("/a2a/tasks/send")
|
||||
async def send(req: dict):
|
||||
task_id = req["params"]["id"]
|
||||
# 매 background worker 에게 dispatch
|
||||
await queue.put((task_id, req["params"]["message"]))
|
||||
return {"jsonrpc":"2.0","id":req["id"],"result":{"id":task_id,"status":{"state":"submitted"}}}
|
||||
```
|
||||
|
||||
### 6) Multi-agent orchestration (A2A + MCP combo)
|
||||
```python
|
||||
# Orchestrator agent: A2A 로 specialist 호출, MCP 로 tool 사용
|
||||
research = await a2a_call("research-agent", query)
|
||||
draft = await claude.messages.create( # MCP tools attached
|
||||
model="claude-opus-4-7",
|
||||
tools=mcp_tools,
|
||||
messages=[{"role":"user","content": f"Draft based on: {research}"}]
|
||||
)
|
||||
```
|
||||
|
||||
### 7) Capability negotiation
|
||||
```python
|
||||
card = httpx.get(agent_url + "/.well-known/agent.json").json()
|
||||
if not card["capabilities"]["streaming"]:
|
||||
# 매 polling fallback
|
||||
use_polling = True
|
||||
```
|
||||
|
||||
## 매 결정 기준
|
||||
| 상황 | Approach |
|
||||
|---|---|
|
||||
| 매 agent ↔ tool / data | MCP |
|
||||
| 매 agent ↔ agent (cross-vendor) | A2A |
|
||||
| 매 same-process agent | Direct call (no protocol) |
|
||||
| 매 long-running (>30s) | A2A + push notification |
|
||||
| 매 strict typing 필요 | A2A + JSON Schema in skill spec |
|
||||
|
||||
**기본값**: 매 cross-org / cross-vendor agent collaboration 에 매 A2A, 매 internal tool wiring 은 매 MCP.
|
||||
|
||||
## 🔗 Graph
|
||||
- 부모: [[Agent Protocols]] · [[JSON-RPC]]
|
||||
- 변형: [[MCP (Model Context Protocol)]] · [[OpenAI Agents SDK]]
|
||||
- 응용: [[Multi-Agent Orchestration]] · [[Agent Marketplace]]
|
||||
- Adjacent: [[OAuth 2.1]] · [[SSE Streaming]]
|
||||
|
||||
## 🤖 LLM 활용
|
||||
**언제**: 매 multi-vendor agent stack 의 interop, 매 long-running specialist agent 의 호출.
|
||||
**언제 X**: 매 single-process tool 호출 (매 MCP 를 사용), 매 latency-critical (<50ms) 의 inner loop.
|
||||
|
||||
## ❌ 안티패턴
|
||||
- **A2A 로 tool 호출**: 매 MCP scope. 매 protocol 혼동.
|
||||
- **No AgentCard**: 매 capability 알려주지 않으면 매 client 가 fallback 못함.
|
||||
- **Sync polling on long task**: 매 push notification 또는 SSE 필수.
|
||||
- **Token leakage**: 매 webhook URL 의 token 검증 누락.
|
||||
|
||||
## 🧪 검증 / 중복
|
||||
- Verified (a2aproject.org spec v0.3, Linux Foundation A2A Project 2025-06-23, Anthropic A2A blog 2025).
|
||||
- 신뢰도 A.
|
||||
|
||||
## 🕓 Changelog
|
||||
| 날짜 | 변경 |
|
||||
|---|---|
|
||||
| 2026-05-08 | Phase 1 |
|
||||
| 2026-05-10 | Manual cleanup — A2A protocol primitives + MCP comparison + 7 working patterns |
|
||||
|
||||
Reference in New Issue
Block a user