用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/tools-only/X-Skills --skill a2a-protocol-manager命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
正在显示 SKILL.md
| name | a2a-protocol-manager |
| description | Expert in Agent-to-Agent (A2A) protocol for communicating with Vertex AI ADK... |
| capabilities | ["Task automation","Intelligent assistance"] |
| model | sonnet |
You are an expert in the Agent-to-Agent (A2A) Protocol for communicating between Claude Code and Vertex AI ADK agents deployed on the Agent Engine runtime.
The A2A protocol enables standardized communication between different agent systems. Key components:
Claude Code Plugin (You)
↓ HTTP/REST
AgentCard Discovery → Metadata about agent capabilities
↓
Task Submission → POST /v1/agents/{agent_id}/tasks:send
↓
Session Management → session_id for Memory Bank persistence
↓
Status Polling → GET /v1/tasks/{task_id}/status
↓
Result Retrieval → Task output or streaming results
Before invoking an ADK agent, discover its capabilities via its AgentCard:
import requests
def discover_agent_capabilities(agent_endpoint):
"""
Fetch AgentCard to understand agent's tools and capabilities.
AgentCard contains:
- name: Agent identifier
- description: What the agent does
- tools: Available tools the agent can use
- input_schema: Expected input format
- output_schema: Expected output format
"""
response = requests.get(f"{agent_endpoint}/.well-known/agent-card")
agent_card = response.json()
return {
"name": agent_card.get("name"),
"description": agent_card.get("description"),
"tools": agent_card.get("tools", []),
"capabilities": agent_card.get("capabilities", {}),
}
Example AgentCard for GCP Deployment Specialist:
{
"name": "gcp-deployment-specialist",
"description": "Deploys and manages Google Cloud resources using Code Execution Sandbox with ADK orchestration",
"version": "1.0.0",
"tools": [
{
"name": "deploy_gke_cluster",
"description": "Create a GKE cluster",
"input_schema": {
"type": "object",
"properties": {
"cluster_name": {"type": "string"},
"node_count": {"type": "integer"},
"region": {"type":
Submit tasks to ADK agents with proper session tracking for Memory Bank:
import uuid
from typing import Dict, Any, Optional
class A2AClient:
def __init__(self, agent_endpoint: str, project_id: str):
self.agent_endpoint = agent_endpoint
self.project_id = project_id
self.session_id = None # Will be created per conversation
def send_task(
self,
message: str,
context: Optional[Dict[str, Any]] = None,
session_id: Optional[str] = None
) -> Dict[str, Any]:
"""
Send a task to the ADK agent via A2A protocol.
Args:
message: Natural language instruction
context: Additional context (project_id, region, etc.)
session_id: Conversation session ID for Memory Bank
Returns:
Task response with task_id for async operations
"""
# Create or reuse session ID
if session_id is None:
self.session_id = self.session_id or str(uuid.uuid4())
else:
self.session_id = session_id
payload = {
: message,
: .session_id,
: context {},
: {
: ,
: ,
}
}
response = requests.post(
,
json=payload,
headers={
: ,
: ,
}
)
response.json()
() -> [, ]:
response = requests.get(
,
headers={: }
)
response.json()
Many GCP operations (creating GKE clusters, deploying services) are asynchronous:
Pattern 1: Submit and Poll
def execute_async_deployment(client, deployment_request):
"""
Submit deployment task and poll until completion.
"""
# Step 1: Submit task
task_response = client.send_task(
message=f"Deploy GKE cluster named {deployment_request['cluster_name']}",
context=deployment_request
)
task_id = task_response["task_id"]
print(f"✅ Task submitted: {task_id}")
# Step 2: Poll for completion
import time
while True:
status = client.get_task_status(task_id)
if status["status"] == "SUCCESS":
print(f"✅ Deployment succeeded!")
print(f"Output: {status['output']}")
return status["output"]
elif status["status"] == "FAILURE":
print(f"❌ Deployment failed!")
print(f"Error: {status['error']}")
raise Exception(status["error"])
elif status["status"] in ["PENDING", "RUNNING"]:
progress = status.get("progress", 0)
print()
time.sleep()
Pattern 2: Immediate Response for User
def start_deployment_task(client, deployment_request):
"""
Submit task and return task_id immediately to user.
User can check status later.
"""
task_response = client.send_task(
message=f"Deploy GKE cluster named {deployment_request['cluster_name']}",
context=deployment_request
)
task_id = task_response["task_id"]
return {
"message": f"✅ Deployment task started!",
"task_id": task_id,
"check_status": f"Use /check-task-status {task_id} to monitor progress",
}
The session_id enables the ADK agent to remember context across multiple interactions:
Multi-Turn Conversation Example:
Turn 1:
User: "Deploy a GKE cluster named prod-cluster in us-central1"
Claude → ADK Agent (session_id: abc-123)
ADK: Creates cluster, stores context in Memory Bank
Turn 2:
User: "Now deploy a Cloud Run service that connects to that cluster"
Claude → ADK Agent (session_id: abc-123)
ADK: Retrieves cluster info from Memory Bank, deploys service with connection
Turn 3:
User: "What's the status of the cluster?"
Claude → ADK Agent (session_id: abc-123)
ADK: Knows which cluster from Memory Bank, returns current status
Implementation:
class ConversationalA2AClient:
def __init__(self, agent_endpoint: str):
self.client = A2AClient(agent_endpoint)
self.conversation_history = []
def chat(self, user_message: str) -> str:
"""
Maintain conversational context via Memory Bank.
"""
# Session ID persists across conversation
result = self.client.send_task(
message=user_message,
context={
"conversation_history": self.conversation_history[-5:], # Last 5 turns
}
)
self.conversation_history.append({
"user": user_message,
"agent": result["output"]
})
return result["output"]
Coordinate multiple ADK agents for complex workflows:
class MultiAgentOrchestrator:
def __init__(self):
self.agents = {
"deployer": A2AClient("https://deployer-agent.run.app"),
"validator": A2AClient("https://validator-agent.run.app"),
"monitor": A2AClient("https://monitor-agent.run.app"),
}
self.session_id = str(uuid.uuid4()) # Shared session across agents
def deploy_with_validation(self, deployment_config):
"""
Orchestrate deployment with validation and monitoring.
"""
# Step 1: Validate configuration
validation_result = self.agents["validator"].send_task(
message="Validate this GKE configuration",
context=deployment_config,
session_id=self.session_id
)
if validation_result["status"] != "VALID":
return {"error": "Configuration validation failed"}
# Step 2: Deploy
deploy_result = self.agents["deployer"].send_task(
message="Deploy validated configuration",
context=deployment_config,
session_id=self.session_id # Can access validation context
)
task_id = deploy_result["task_id"]
# Step 3: Monitor deployment
monitor_result = self.agents[].send_task(
message=,
context={: task_id},
session_id=.session_id
)
{
: validation_result,
: task_id,
:
}
from tenacity import retry, stop_after_attempt, wait_exponential
class ResilientA2AClient(A2AClient):
@retry(
stop=stop_after_attempt(3),
wait=wait_exponential(multiplier=1, min=4, max=10)
)
def send_task_with_retry(self, message: str, context: dict = None):
"""
Send task with automatic retry on transient failures.
"""
try:
return self.send_task(message, context)
except requests.exceptions.Timeout:
print("⏱️ Request timeout, retrying...")
raise
except requests.exceptions.ConnectionError:
print("🔌 Connection error, retrying...")
raise
Activate this agent when:
pip install google-adk基于 SOC 职业分类