From ag2-agent-scaffold
Scaffold a new A2A (Agent-to-Agent) compliant agent with server wiring, card settings, and skill definitions. Use for agents that will be deployed as A2A services.
How this skill is triggered — by the user, by Claude, or both
Slash command
/ag2-agent-scaffold:new-a2a-agentThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
You are scaffolding a new A2A-compliant AG2 agent for deployment as a standalone service.
You are scaffolding a new A2A-compliant AG2 agent for deployment as a standalone service.
Ask the user for:
Create the agent following this exact structure:
agents/<agent-name>/
<agent_name>.py # Agent + tools + A2A server
README.md # Capabilities, setup, environment variables
import json
import os
from autogen import ConversableAgent, LLMConfig
from autogen.tools import tool
from a2a_agent_server import A2aAgentServer, CardSettings, Skill
# --- Tool Functions ---
@tool()
def example_tool(query: str) -> str:
"""Description of what this tool does.
Args:
query: The input query to process
"""
try:
result = {"items": [], "count": 0}
return json.dumps({"success": True, "data": result})
except Exception as e:
return json.dumps({"success": False, "error": str(e)})
# --- Agent Definition ---
agent = ConversableAgent(
name="agent_name",
description="One-line description for discovery and routing",
system_message="""You are a [role] specialist.
Your capabilities:
- [List specific capabilities]
When using tools:
- Always check the success field in tool responses
- If a tool fails, explain the error clearly to the user
- Never fabricate data -- only report what tools return
""",
llm_config=LLMConfig({"api_type": "anthropic", "model": "claude-sonnet-4-6"}),
functions=[example_tool],
)
# --- A2A Server ---
server = A2aAgentServer(
agent,
url="http://0.0.0.0:8000/agent-name/",
agent_card=CardSettings(
organization="AG2 AI",
version="1.0.0",
capabilities=["capability_1", "capability_2"],
authentication_schemes=["Bearer"],
default_input_modes=["text/plain"],
default_output_modes=["text/plain", "application/json"],
skills=[
Skill(
id="skill_one",
description="Human-readable description of this skill",
examples=["Example request that uses this skill"],
),
Skill(
id="skill_two",
description="Another skill description",
examples=["Another example request"],
),
],
),
).build()
Add to the AGENT_ROUTES dict:
from agents.<agent_name>.<agent_name> import server as <agent_name>_server
AGENT_ROUTES = {
# ... existing agents ...
"<agent-name>": <agent_name>_server,
}
Once mounted, the agent card is available at:
GET http://localhost:8000/<agent-name>/.well-known/agent.json
# <Agent Name>
## Overview
Brief description of what this agent does.
## Skills
- **skill_one**: Description
- **skill_two**: Description
## Environment Variables
- `API_KEY`: Required. Description of the key.
## Example Requests
- "Do something specific"
- "Another example request"
connector_setup_required:<id> on missing authnpx claudepluginhub ag2ai/ag2-claude-plugins --plugin ag2-agent-scaffoldCreates and configures A2A Agent Cards—JSON discovery documents detailing agent identity, capabilities, skills, authentication schemes, and endpoints for agent-to-agent delegation.
Designs an A2A Agent Card (.well-known/agent.json) manifest describing agent capabilities, skills, authentication, and content types for multi-agent discovery and orchestration.
A2A agent card JSON templates with schema validation and examples for different agent types. Use when creating agent cards, implementing A2A protocol discovery, setting up agent metadata, configuring authentication schemes, defining agent capabilities, or when user mentions agent card, agent discovery, A2A metadata, service endpoint configuration, or agent authentication setup.